jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/423701 )

Change subject: [bugfix] ensure "modules" parameter of ParamInfo._fetch is a set
......................................................................

[bugfix] ensure "modules" parameter of ParamInfo._fetch is a set

Bug: T122763
Change-Id: I896b8cdd85bed894c23824f31c99f3b86f36257c
---
M pywikibot/data/api.py
1 file changed, 15 insertions(+), 3 deletions(-)

Approvals:
  Zhuyifei1999: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index f7e4745..1b86cf5 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Interface to Mediawiki's api.php."""
 #
-# (C) Pywikibot team, 2007-2018
+# (C) Pywikibot team, 2007-2019
 #
 # Distributed under the terms of the MIT license.
 #
@@ -541,6 +541,17 @@

         self._emulate_pageset()

+    @staticmethod
+    def _modules_to_set(modules):
+        """Return modules as a set.
+
+        @type modules: iterable or basestring
+        @rtype: set
+        """
+        if isinstance(modules, basestring):
+            return set(modules.split('|'))
+        return set(modules)
+
     def fetch(self, modules):
         """
         Fetch paraminfo for multiple modules.
@@ -557,6 +568,8 @@
             # query modules can be prefixed with 'query+'
             self._init()

+        modules = self._modules_to_set(modules)
+
         if self._action_modules:
             # The query module may be added before the action modules have been
             if 'query' in self._modules:
@@ -740,8 +753,7 @@
     def _normalize_modules(self, modules):
         """Add query+ to any query module name not also in action modules."""
         # Users will supply the wrong type, and expect it to work.
-        if isinstance(modules, basestring):
-            modules = set(modules.split('|'))
+        modules = self._modules_to_set(modules)

         assert(self._action_modules)


--
To view, visit https://gerrit.wikimedia.org/r/423701
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I896b8cdd85bed894c23824f31c99f3b86f36257c
Gerrit-Change-Number: 423701
Gerrit-PatchSet: 7
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: Framawiki <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: Zhuyifei1999 <[email protected]>
Gerrit-Reviewer: Zoranzoki21 <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to