[issue18071] _osx_support compiler_fixup

Ned Deily report at bugs.python.org
Tue May 28 00:51:06 CEST 2013


Ned Deily added the comment:

Sorry, I am unable to reproduce the problem with a vanilla Python 2.7.5 and a downloaded Cython 0.19.1 either installing directly with Cython's setup.py or using Pip 1.3.1.  customize_compiler is used as part of every extension module build in Distutils; it is not something special. AFAICT, the compiler_so attribute of a CCompiler instance should always be a list.  It is intended to be set up as such by the set_executables method of CCompiler (Lib/distutils/ccompiler.py) which calls set_executable for each item, including compiler_so.

Now there could be a problem in Python 2 if, for some reason, the value for 'compiler_so' has become a Unicode string: set_executable is looking only for an instance of type str.  It looks like the original value for 'compiler_so' is constructed in customize_compiler (in lib/distutils/sysconfig.py) by first concatenating CC + ' ' + CFLAGS, where the CC and CFLAGS values are obtained from the Python build (using get_config_vars) and possibly overridden by environment variables of the same names.  Then the value of the config var 'CCSHARED' is appended; it most likely is empty.  So I would check to see the types of distutils.sysconfig.get_config_var("CC") and ("CFLAGS") and ("CCSHARED") as well as os.environ["CC"] and ["CFLAGS"].  If any of them return a type unicode string, I think that could explain the behavior you see. The use of Unicode strings for these kinds of values are likely to lead to trouble, one way or another, in Python 2 for sure.  (Also, be aware that Cython extends Distutils with its own build_ext to allow building of Cython modules. I took a very quick look at it and did not see any obvious problems.)

----------
assignee: ronaldoussoren -> ned.deily

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18071>
_______________________________________


More information about the Python-bugs-list mailing list