-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distutils generates the wrong export symbol for unicode module names #83613
Comments
Distuitls generates "export symbols" for extension modules to help ensure that they have have the correct linkage on Windows. cpython/Lib/distutils/command/build_ext.py Line 692 in 0d30ae1
It generates the correct symbol in most causes, but if the filename contains unicode characters then it creates the wrong symbol, causing linkage errors. The behaviour should be updated to reflect PEP-489: https://www.python.org/dev/peps/pep-0489/#export-hook-name |
Ok, this is merged into 3.9. To which versions should we backport it? |
The test fails on Windows. Example on AMD64 Windows8.1 Refleaks 3.x: ====================================================================== Traceback (most recent call last):
File "D:\buildarea\3.x.ware-win81-release.refleak\build\lib\distutils\tests\test_build_ext.py", line 315, in test_unicode_module_names
self.assertRegex(cmd.get_ext_filename(modules[0].name), r'foo\..*')
AssertionError: Regex didn't match: 'foo\\..*' not found in 'foo_d.cp39-win_amd64.pyd' ====================================================================== Traceback (most recent call last):
File "D:\buildarea\3.x.ware-win81-release.refleak\build\lib\distutils\tests\test_build_ext.py", line 315, in test_unicode_module_names
self.assertRegex(cmd.get_ext_filename(modules[0].name), r'foo\..*')
AssertionError: Regex didn't match: 'foo\\..*' not found in 'foo_d.cp39-win_amd64.pyd' |
Python 3.6 doesn't accept bugfixes anymore: The bugfix can go into 3.7 and 3.8. |
I put a breakpoint before the error: test_unicode_module_names (distutils.tests.test_build_ext.BuildExtTestCase) ... > c:\vstinner\python\master\lib\distutils\tests |
On Windows, names get a "_d" suffix for debug. Extract of build_ext.py: def get_libraries(self, ext):
"""Return the list of libraries to link against when building a
shared extension. On most platforms, this is just 'ext.libraries';
on Windows, we add the Python library (eg. python20.dll).
"""
# The python library is always needed on Windows. For MSVC, this
# is redundant, since the library is mentioned in a pragma in
# pyconfig.h that MSVC groks. The other Windows compilers all seem
# to need it mentioned explicitly, though, so that's what we do.
# Append '_d' to the python import library on debug builds.
if sys.platform == "win32":
from distutils._msvccompiler import MSVCCompiler
if not isinstance(self.compiler, MSVCCompiler):
template = "python%d%d"
if self.debug:
template = template + '_d'
(...) |
We should not be changing Distutils 3.7 behavior at this late point in its life cycle, particularly since AFAIK this issue has not come up before. Let's see what Łukasz thinks for 3.8. |
I'm with Stefan on "Definitely 3.8". It's a bug fix (for a rarely used feature). |
It looks like this wasn't quite fixed by the patch: the patch encoded I've submitted a revised version to setuptools pypa/setuptools#2646. My impression is that distutils is no longer updated and so there's no value in submitting this patch to Python too. However, I can do so if it would be used. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: