jenkins-bot merged this change.

View Change

Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
[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(-)

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(

To view, visit change 518192. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I20a42ca67ab9d9692b6bcb22e33ab740a76f03cc
Gerrit-Change-Number: 518192
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)