jenkins-bot merged this change.
[bugfix] Don't force re-login when logging in
site.login() calls site.getuserinfo(force=True), which can call
site._relogin() here.
Bug: T248767
Change-Id: I66ba066bceb47f360f563f0859184a163feb4cbb
---
M pywikibot/data/api.py
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 5e72deb..071932a 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1788,7 +1788,9 @@
# that we are logged in as the correct user. If this is not the
# case, force a re-login.
username = result['query']['userinfo']['name']
- if self.site.user() is not None and self.site.user() != username:
+ if (self.site.user() is not None and self.site.user() != username
+ and self.site._loginstatus
+ != pywikibot.site.LoginStatus.IN_PROGRESS):
pywikibot.error(
"Logged in as '{actual}' instead of '{expected}'.\n"
'Forcing re-login.'.format(actual=username,
To view, visit change 584538. To unsubscribe, or for help writing mail filters, visit settings.