jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
win32_unicode.py: Do not work around issue2128 for PY3

I'm having trouble working with pydev debugger on Windows because its
cmd arguments (--multiproc, --qt-support=auto, --client, --port, and
--file) are included in GetCommandLineW results. That leads to
superfluous arguments being passed to pywikibot which is sometimes
forbidden.[1] The default sys.argv does not have this issue.

issue2128 does not exist in Python 3. So at least for Python 3 we
don't need the workaround.

[1]: For example see:
https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/generate_user_files.py;bcb30ef9d15e7c1a457fd622b0799e917d3b966b$431

Change-Id: If7e736e09fafe78e24ca34aceed8df0d96a35d1f
---
M pywikibot/userinterfaces/win32_unicode.py
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py
index 45588fe..3287e0a 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -337,6 +337,10 @@
_complain('exception {!r} while fixing up sys.stdout and sys.stderr'
.format(e))

+ if PY3:
+ # no need to work around issue2128 since it's a Python 2 only issue
+ return stdin, stdout, stderr, argv
+
# While we're at it, let's unmangle the command-line arguments:

# This works around <http://bugs.python.org/issue2128>.

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If7e736e09fafe78e24ca34aceed8df0d96a35d1f
Gerrit-Change-Number: 439383
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot