jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/915392 )
Change subject: [IMPR] do not evaluate Site() with dict.pop() as default value ......................................................................
[IMPR] do not evaluate Site() with dict.pop() as default value
Bug: T335720 Change-Id: Ic62d52fb5fdfde1b2af53003f0e38f804363f2f2 --- M scripts/interwiki.py M pywikibot/comms/eventstreams.py 2 files changed, 19 insertions(+), 3 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py index cd9c280..7f07bc0 100644 --- a/pywikibot/comms/eventstreams.py +++ b/pywikibot/comms/eventstreams.py @@ -10,7 +10,7 @@ .. versionadded:: 3.0 """ # -# (C) Pywikibot team, 2017-2022 +# (C) Pywikibot team, 2017-2023 # # Distributed under the terms of the MIT license. # @@ -143,7 +143,10 @@ 'install it with "pip install sseclient"\n') self.filter = {'all': [], 'any': [], 'none': []} self._total = None - self._site = kwargs.pop('site', Site()) + try: + self._site = kwargs.pop('site') + except KeyError: # T335720 + self._site = Site()
self._streams = kwargs.pop('streams', None) if self._streams and not isinstance(self._streams, str): diff --git a/scripts/interwiki.py b/scripts/interwiki.py index a8cb116..580a9d0 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -2147,7 +2147,10 @@ :keyword do_continue: If true, continue alphabetically starting at the last of the dumped pages. """ - self.site = kwargs.pop('site', pywikibot.Site()) + try: + self.site = kwargs.pop('site') + except KeyError: # T335720 + self.site = pywikibot.Site() super().__init__(**kwargs)
self.restored_files = set()