D5734: url: add some defensive asserts on expected incoming types
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Tue Jan 29 20:12:49 UTC 2019
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5734
AFFECTED FILES
mercurial/url.py
CHANGE DETAILS
diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -58,6 +58,8 @@
return self.passwddb.add_password(realm, uri, user, passwd)
def find_user_password(self, realm, authuri):
+ assert isinstance(realm, (type(None), str))
+ assert isinstance(authuri, str)
authinfo = self.passwddb.find_user_password(realm, authuri)
user, passwd = authinfo
if user and passwd:
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list