# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 2019-01-29 18:24:20
# Node ID bc776c31c093c5fc79c13040e67de19c7d11d3d6
# Parent  fa7d61f9c512ba9b06d1e194eb483fe69aae408a

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

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -58,6 +58,8 @@ class passwordmgr(object):
         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: