Commit 7f408bff authored by Stefan Behnel's avatar Stefan Behnel

pyximport: make sure we encode extension file paths to 'str' in Py2 to work around distutils quirk

parent c5be029b
...@@ -93,6 +93,10 @@ def get_distutils_extension(modname, pyxfilename, language_level=None): ...@@ -93,6 +93,10 @@ def get_distutils_extension(modname, pyxfilename, language_level=None):
# modname = modname + extra # modname = modname + extra
extension_mod,setup_args = handle_special_build(modname, pyxfilename) extension_mod,setup_args = handle_special_build(modname, pyxfilename)
if not extension_mod: if not extension_mod:
if not isinstance(pyxfilename, str):
# distutils is stupid in Py2 and requires exactly 'str'
# => encode accidentally coerced unicode strings back to str
pyxfilename = pyxfilename.encode(sys.getfilesystemencoding())
from distutils.extension import Extension from distutils.extension import Extension
extension_mod = Extension(name = modname, sources=[pyxfilename]) extension_mod = Extension(name = modname, sources=[pyxfilename])
if language_level is not None: if language_level is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment