jenkins-bot merged this change.

View Change

Approvals: Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
[Python] Deprecation warning for Python 3.4

Bug: T239542
Change-Id: Ie656f71cb109ec1db951562ebc2a13e3c37281da
---
M pywikibot/__init__.py
M tests/utils.py
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 903d147..7214aa2 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -15,6 +15,7 @@
from decimal import Decimal
import math
import re
+import sys
import threading
import time

@@ -65,7 +66,7 @@
MediaWikiVersion as _MediaWikiVersion,
redirect_func,
ModuleDeprecationWrapper as _ModuleDeprecationWrapper,
- PY2,
+ PY2, PYTHON_VERSION,
UnicodeMixin,
UnicodeType
)
@@ -115,12 +116,14 @@
# T111615: Python 2 requires __all__ is bytes
globals()['__all__'] = tuple(bytes(item) for item in __all__)

- import sys
+if PY2 or PYTHON_VERSION < (3, 5, 0):
warn("""
+
Python {version} will be dropped soon.
It is recommended to use Python 3.5 or above.
-See T213287 for further information.
-""".format(version=sys.version.split(None, 1)[0]),
+See {what} for further information.
+""".format(version=sys.version.split(None, 1)[0],
+ what='T213287' if PY2 else 'T239542'),
FutureWarning) # probably adjust the line no in utils.execute()

for _name in textlib_methods:
diff --git a/tests/utils.py b/tests/utils.py
index 3f73c08..1d917cb 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -654,8 +654,8 @@
@param command: executable to run and arguments to use
@type command: list of unicode
"""
- if PY2:
- command.insert(1, '-W ignore::FutureWarning:pywikibot:124')
+ if PY2 or PYTHON_VERSION < (3, 5, 0):
+ command.insert(1, '-W ignore::FutureWarning:pywikibot:127')
if cryptography_version and cryptography_version < [1, 3, 4]:
command.insert(1, '-W ignore:Old version of cryptography:Warning')
# Any environment variables added on Windows must be of type

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie656f71cb109ec1db951562ebc2a13e3c37281da
Gerrit-Change-Number: 553861
Gerrit-PatchSet: 7
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999@gmail.com>
Gerrit-Reviewer: jenkins-bot (75)