Skip to content
Browse files

pyximport: make sure we encode extension file paths to 'str' in Py2 t…

…o work around distutils quirk
  • Loading branch information...
1 parent c5be029 commit 7f408bff370ec05de9c14b76b24e1db9817a094f @scoder scoder committed Aug 16, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 pyximport/pyximport.py
View
4 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:

0 comments on commit 7f408bf

Please sign in to comment.
Something went wrong with that request. Please try again.