Message190140
In the `_osx_support.py` module, there seems to be a bug in the method `compiler_fixup` which occurs if
* the `customize_compiler` method from `distutils/sysconfig` has been called and after that
* `_compile` from `distutils/unixcompiler.py` is called. The `_compile` method uses `_osx_support.compiler_fixup`.
The critical line in compiler_fixup is:
`compiler_so = list(compiler_so)`.
Usually `compiler_so` is a list like `['cc']` but not when `customize_compiler` (from sysconfig) has been called. The value returned by `sysconfig.get_config_var('LDSHARED')` is a unicode like for example in the case of a Python 2.7.5 built via Homebrew:
"cc -bundle -undefined dynamic_lookup -L/homebrew/lib -L/homebrew/opt/sqlite/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk".
When `list()` is applied to the value, it is split at each character and that cannot be intended.
I am not sure if I fully understand, but to fix this in `compiler_fixup`, instead of `compiler_so = list(compiler_so)`, I'd propose something along the lines of:
if isinstance(compiler_so, (str,unicode)):
compiler_so = compiler_so.split()
I found this by trying to `pip install cython` (it uses customize_compiler, I guess) on a homebrewed python.
To reproduce in an interactive shell we can emulate what is going on by calling `compiler_fixup` directly with the values sysconfig has stored. The exact string does not matter, because I think the any value returned by `sysconfig_get_config_var` is a (unicode) string and not a list:
import sysconfig
import _osx_support
_osx_support.compiler_fixup(sysconfig.get_config_var('LDSHARED'),sysconfig.get_config_var('CFLAGS'))
Not sure if other python versions are affected. I wasn't aware of `_osx_support` at all until now. |
|
Date |
User |
Action |
Args |
2013-05-27 14:07:21 | samueljohn | set | recipients:
+ samueljohn, ronaldoussoren, ned.deily, hynek |
2013-05-27 14:07:21 | samueljohn | set | messageid: <1369663641.63.0.31152522756.issue18071@psf.upfronthosting.co.za> |
2013-05-27 14:07:21 | samueljohn | link | issue18071 messages |
2013-05-27 14:07:20 | samueljohn | create | |
|