mercurial/url.py
branchstable
changeset 45759 ff48eea4a926
parent 44783 a50f33f1ff24
child 45942 89a2afe31e82
--- a/mercurial/url.py	Fri Oct 23 20:10:17 2020 +0900
+++ b/mercurial/url.py	Fri Oct 23 20:33:36 2020 +0900
@@ -96,6 +96,13 @@
             if not passwd:
                 passwd = self.ui.getpass()
 
+        # As of Python 3.8, the default implementation of
+        # AbstractBasicAuthHandler.retry_http_basic_auth() assumes the user
+        # is set if pw is not None. This means (None, str) is not a valid
+        # return type of find_user_password().
+        if user is None:
+            return None, None
+
         self.passwddb.add_password(realm, authuri, user, passwd)
         self._writedebug(user, passwd)
         return (pycompat.strurl(user), pycompat.strurl(passwd))