diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2012-08-16 09:00:03 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2012-08-16 09:00:03 +0200 |
commit | 7f408bff370ec05de9c14b76b24e1db9817a094f (patch) | |
tree | dffb8be536008f85327eecba4169de793aead035 /pyximport | |
parent | c5be029b975f7dff3c70230d4b194c1cadbda85f (diff) | |
download | cython-7f408bff370ec05de9c14b76b24e1db9817a094f.tar.gz |
pyximport: make sure we encode extension file paths to 'str' in Py2 to work around distutils quirk
Diffstat (limited to 'pyximport')
-rw-r--r-- | pyximport/pyximport.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py index 43814e15b..7685fd12c 100644 --- a/pyximport/pyximport.py +++ b/pyximport/pyximport.py @@ -93,6 +93,10 @@ def get_distutils_extension(modname, pyxfilename, language_level=None): # modname = modname + extra extension_mod,setup_args = handle_special_build(modname, pyxfilename) 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 extension_mod = Extension(name = modname, sources=[pyxfilename]) if language_level is not None: |