comparison mercurial/url.py @ 41449:bc776c31c093

url: add some defensive asserts on expected incoming types Our type handling is a nightmare here, and we're loading passwords to do network IO, so we can afford to be potentially-slow but pedantic here. Differential Revision: https://phab.mercurial-scm.org/D5734
author Augie Fackler <augie@google.com>
date Tue, 29 Jan 2019 13:24:20 -0500
parents 6509fcec830c
children d437d1e2a711
comparison
equal deleted inserted replaced
41448:fa7d61f9c512 41449:bc776c31c093
56 56
57 def add_password(self, realm, uri, user, passwd): 57 def add_password(self, realm, uri, user, passwd):
58 return self.passwddb.add_password(realm, uri, user, passwd) 58 return self.passwddb.add_password(realm, uri, user, passwd)
59 59
60 def find_user_password(self, realm, authuri): 60 def find_user_password(self, realm, authuri):
61 assert isinstance(realm, (type(None), str))
62 assert isinstance(authuri, str)
61 authinfo = self.passwddb.find_user_password(realm, authuri) 63 authinfo = self.passwddb.find_user_password(realm, authuri)
62 user, passwd = authinfo 64 user, passwd = authinfo
63 if user and passwd: 65 if user and passwd:
64 self._writedebug(user, passwd) 66 self._writedebug(user, passwd)
65 return (user, passwd) 67 return (user, passwd)