[bugfix] Fix RuntimeError in Python 3.8
[bugfix] Fix RuntimeError in Python 3.8

Bug: T238637
Change-Id: I5f89d04a2c47691120619d85d90f9106bc6ff84f

PersianWikipedia/pywikibot-core,wikimedia/pywikibot-core,wikimedia/pywikibot-core