Steps to replicate the issue:
Try to logout if you are already logged out
D:\pwb\GIT\core>pwb login -logout WARNING: No user is logged in on site wikipedia:de Password for user Xqtest on wikipedia:de (no characters will be shown): Logging in to wikipedia:de as Xqtest Logged out of wikipedia:de.
D:\pwb\GIT\core>pwb shell Welcome to the Pywikibot interactive shell! >>> site = pywikibot.Site() >>> site.logged_in() False >>> site.logout() WARNING: No user is logged in on site wikipedia:de Password for user Xqtest on wikipedia:de (no characters will be shown): Logging in to wikipedia:de as Xqtest >>> site.logged_in() False >>>
What happens here?:
API:Logout needs a token (see also T222508). To get the token a login() is made after rPWBCc4fbf0c if necessary.
If you are logged in a logout() works as expected:
>>> site = pywikibot.Site() >>> site.logged_in() False >>> site.login() WARNING: No user is logged in on site wikipedia:de Password for user Xqtest on wikipedia:de (no characters will be shown): Logging in to wikipedia:de as Xqtest >>> site.logged_in() True >>> site.logout()
What should have happened instead?:
No login() should be made during logout()
Software version (skip for WMF-hosted wikis like Wikipedia):
Pywikibot 3.0.20190722+