[issue34297] Windows py.exe launcher fail to handle quote correctly

2018-07-31 Thread Francois Godin


Change by Francois Godin :


--
type:  -> behavior
versions: +Python 2.7, Python 3.4, Python 3.5

___
Python tracker 
<https://bugs.python.org/issue34297>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34297] Windows py.exe launcher fail to handle quote correctly

2018-07-31 Thread Francois Godin


New submission from Francois Godin :

Using double quote around the version argument will cause a failure.

Ex (failure): "py.exe" "-3" "test.py" 
=> run_child: about to run '3" "...\python.exe" "test.py"'
=> ...\python.exe: can't open file '3 test.py': [Errno 22] Invalid argument

Removing the double quote give (success): "py.exe" -3 "test.py" => run_child: 
about to run '"...\python.exe" "test.py"'

This is mainly problematic when a library or a tool want to be simpler and 
simply add double quotes around every parameters. This is impossible to do with 
the python launcher.

The issue seems to come from the PC/launcher.c file. It is the following line 
in the function process (around line 1622): command += wcslen(p);

This line is suppose to skip the -3 in the command line so that the rest can be 
given to python as-is. The problem is that while command come from 
GetCommandLineW and thus contain quote, p come from __wargv and does not 
contain the double quote. Thus, the 2 characters "- are skipped instead of -3.

--
components: Demos and Tools, Distutils, Windows
messages: 322802
nosy: copelnug, dstufft, eric.araujo, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: Windows py.exe launcher fail to handle quote correctly
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue34297>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com