jenkins-bot has submitted this change and it was merged.
Change subject: Use Site interface in cache key ......................................................................
Use Site interface in cache key
pywikibot.Site is invoked with different values for 'interface', notably 'DataSite' is used by APISite.data_repository().
If a DataSite is instantiated before an APISite for a wiki, it is cached, and returned when an APISite object is requested. DataSite overrides APISite/BaseSite methods, including raising exceptions for deprecated methods, so the cached & returned DataSite is not an acceptable returned value if an APISite was requested.
Bug: 71451 Change-Id: I93195dcba3185c6df233bac89ed981ddccc78abd --- M pywikibot/__init__.py 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 394043c..dd3d4f1 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -528,7 +528,7 @@ __Site = getattr(tmp, interface) except ImportError: raise ValueError("Invalid interface name '%(interface)s'" % locals()) - key = '%s:%s:%s' % (fam, code, user) + key = '%s:%s:%s:%s' % (interface, fam, code, user) if key not in _sites or not isinstance(_sites[key], __Site): _sites[key] = __Site(code=code, fam=fam, user=user, sysop=sysop) debug(u"Instantiating Site object '%(site)s'"
pywikibot-commits@lists.wikimedia.org