[issue4508] distutils compiler not handling spaces in path to output/src files

Brian Thorne report at bugs.python.org
Sun Aug 5 12:58:47 CEST 2012


Brian Thorne added the comment:

I've put together a patch adding the test requested. There is no problem on my Ubuntu machine with python 3.3.
There is a comment in the file saying Don't load the xx module more than once, I am unsure whether my patch (using a renamed c file) violates this?


One extremely minor nitpick that I'll mention is inconsistency with spaces in the module name. One can create a python file "my file.py" and can import it with __import__("my file"). I couldn't do the same for a C extension.

Building a C extension with distutils:

  module_name = 'ex ample'
  example_ext = Extension(module_name, [target_c])
  dist = Distribution({'name': module_name, 'ext_modules': [example_ext]})

Doesn't work due to the import mechanism looks for a PyInit function with the new module name (including a space):

  ImportError: dynamic module does not define init function (PyInit_ex ample)

I don't think this is worth making a ticket over.

----------
Added file: http://bugs.python.org/file26700/distutils_space_test.patch

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


More information about the Python-bugs-list mailing list