Chris Hogan added the comment:

At Intel, we've run into problems with external modules giving paths to 
_nt_quote_args that contain trailing backslashes, which escapes the final quote 
and breaks the command.  This fix takes care of special characters, trailing 
backslashes, and embedded quotes as in Matt's example.  I've also added unit 
tests for these cases, as well as a high level test that builds an extension 
and defines some macros that contain quotes and special characters. 

setup.py - Includes a library directory with a trailing backslash. I compiled a 
simple library, test_module.lib, and put it in that directory to test the 
linking.  This fails without my fix.  The macro definitions also fail without 
this fix.

testmodule.c - A simple C extension.  It just makes sure everything worked and 
returns the string "Success!"

As for current workarounds in setup scripts, I know numpy uses their own 
distutils.  They wrote a quote_args() function that they use instead of 
_nt_quote_args(). It checks for spaces, but only if the argument isn't already 
quoted.  It doesn't account for other special characters or trailing 
backslashes.

----------
nosy: +christopher.hogan
Added file: http://bugs.python.org/file40204/quote-args.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8987>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to