jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/402588 )
Change subject: ModuleDeprecationWrapper._add_deprecated_attr: Delete existing attribute ......................................................................
ModuleDeprecationWrapper._add_deprecated_attr: Delete existing attribute
In Python __getattr__ is only invoked if object does not have the requested attribute. If the deprecated module has the attribute, then the __getattr__ method of ModuleDeprecationWrapper will not be invoked and therefore no warning will be issued.
Bug: T184337 Change-Id: I4193481a0bd1b2fa310f15a8bddb7a4e2f090134 --- M pywikibot/tools/__init__.py 1 file changed, 3 insertions(+), 0 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index b9c99e0..8acdf51 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -1733,6 +1733,9 @@ else: warning_message = u"{0}.{1} is deprecated."
+ if hasattr(self, name): + # __getattr__ will only be invoked if self.<name> does not exist. + delattr(self, name) self._deprecated[name] = replacement_name, replacement, warning_message
def __setattr__(self, attr, value):
pywikibot-commits@lists.wikimedia.org