changeset 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 fa7d61f9c512
children d437d1e2a711
files mercurial/url.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/url.py	Tue Jan 29 16:03:52 2019 +0300
+++ b/mercurial/url.py	Tue Jan 29 13:24:20 2019 -0500
@@ -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: