summaryrefslogtreecommitdiff
path: root/setuptools/_distutils/command/build_ext.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-07-18 15:13:50 -0400
committerJason R. Coombs <jaraco@jaraco.com>2021-07-18 15:13:50 -0400
commit01f2abe71dc72fdf5b345f4ac3086a94b23efd15 (patch)
tree83bee7a6d933efe516f549423bff38f0d303a760 /setuptools/_distutils/command/build_ext.py
parent5c24e780b83e4557ca6e9e48b468e6f4a82695c9 (diff)
parentaa5ef507f3bf78092abfff7c6a2cf55a9b2fb2dc (diff)
downloadpython-setuptools-git-01f2abe71dc72fdf5b345f4ac3086a94b23efd15.tar.gz
Merge branch 'main' into change-docs-theme
Diffstat (limited to 'setuptools/_distutils/command/build_ext.py')
-rw-r--r--setuptools/_distutils/command/build_ext.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/setuptools/_distutils/command/build_ext.py b/setuptools/_distutils/command/build_ext.py
index bbb34833..f7ab32cf 100644
--- a/setuptools/_distutils/command/build_ext.py
+++ b/setuptools/_distutils/command/build_ext.py
@@ -690,13 +690,15 @@ class build_ext(Command):
provided, "PyInit_" + module_name. Only relevant on Windows, where
the .pyd file (DLL) must export the module "PyInit_" function.
"""
- suffix = '_' + ext.name.split('.')[-1]
+ name = ext.name.split('.')[-1]
try:
# Unicode module name support as defined in PEP-489
# https://www.python.org/dev/peps/pep-0489/#export-hook-name
- suffix.encode('ascii')
+ name.encode('ascii')
except UnicodeEncodeError:
- suffix = 'U' + suffix.encode('punycode').replace(b'-', b'_').decode('ascii')
+ suffix = 'U_' + name.encode('punycode').replace(b'-', b'_').decode('ascii')
+ else:
+ suffix = "_" + name
initfunc_name = "PyInit" + suffix
if initfunc_name not in ext.export_symbols: