jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/518192 )
Change subject: [bugfix] T113120 is solved for Python 3.5+ ......................................................................
[bugfix] T113120 is solved for Python 3.5+
Bug: T113120 Change-Id: I20a42ca67ab9d9692b6bcb22e33ab740a76f03cc --- M pywikibot/data/api.py 1 file changed, 11 insertions(+), 12 deletions(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 5f92b76..09d0648 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -43,20 +43,15 @@ ) from pywikibot.tools.formatter import color_format
-if not PY2: - # Subclassing necessary to fix a possible bug of the email package - # in py3: see http://bugs.python.org/issue19003 - # The following solution might be removed if/once the bug is fixed, - # unless the fix is not backported to py3.x versions that should - # instead support PWB. - from urllib.parse import urlencode, unquote +if PYTHON_VERSION[:2] == (3, 4): # T113120 + # Subclassing necessary to fix a bug of the email package + # in Python 3.4: see http://bugs.python.org/issue19003
+ from email.generator import BytesGenerator + from email.mime.multipart import MIMEMultipart as MIMEMultipartOrig from io import BytesIO
- import email.generator - from email.mime.multipart import MIMEMultipart as MIMEMultipartOrig - - class CTEBinaryBytesGenerator(email.generator.BytesGenerator): + class CTEBinaryBytesGenerator(BytesGenerator):
"""Workaround for bug in python 3 email handling of CTE binary."""
@@ -85,9 +80,13 @@
MIMEMultipart = CTEBinaryMIMEMultipart else: - from urllib import urlencode, unquote from email.mime.multipart import MIMEMultipart
+if not PY2: + from urllib.parse import urlencode, unquote +else: + from urllib import urlencode, unquote + _logger = 'data.api'
lagpattern = re.compile(