jenkins-bot submitted this change.
[bugfix] Avoid conflicts between site and possible site keyword
Avoid conflicts in:
- site._simple_request
- api.create_simple
Bug: T262926
Change-Id: I23e8631f58d6d537425e446b31b4377d16101711
---
M pywikibot/data/api.py
M pywikibot/site/__init__.py
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 512d246..9f2122d 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1181,15 +1181,17 @@
self['assert'] = 'user' # make sure user is logged in
@classmethod
- def create_simple(cls, site, **kwargs):
+ def create_simple(cls, req_site, **kwargs):
"""Create a new instance using all args except site for the API."""
# This ONLY support site so that any caller can be sure there will be
# no conflict with PWB parameters
+ # req_site is needed to avoid conflicts with possible site keyword in
+ # kwarg, see T262926
# TODO: Use ParamInfo request to determine valid parameters
if isinstance(kwargs.get('parameters'), dict):
warn('The request contains already a "parameters" entry which is '
'a dict.')
- return cls(site, parameters=kwargs)
+ return cls(req_site, parameters=kwargs)
@classmethod
def _warn_both(cls):
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index 924b32c..c21feb2 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -1414,7 +1414,7 @@
def _simple_request(self, **kwargs):
"""Create a request by defining all kwargs as parameters."""
return self._request_class({'parameters': kwargs}).create_simple(
- site=self, **kwargs)
+ self, **kwargs)
@remove_last_args(['sysop'])
def logged_in(self):
To view, visit change 637846. To unsubscribe, or for help writing mail filters, visit settings.