summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-25 20:13:10 +0200
committerGitHub <noreply@github.com>2019-04-25 20:13:10 +0200
commiteb3478f2cdccd5489b64f7bb8cec4988fba985c7 (patch)
treeea8971c21ec0bc594f8a50c07e9b9f44d1ea2097
parent89a5c175e47d95d33a700eedecf402e78d2a964a (diff)
downloadpython-setuptools-git-eb3478f2cdccd5489b64f7bb8cec4988fba985c7.tar.gz
bpo-21536: C extensions are no longer linked to libpython (GH-12946)
On Unix, C extensions are no longer linked to libpython. It is now possible to load a C extension built using a shared library Python with a statically linked Python. When Python is embedded, libpython must not be loaded with RTLD_LOCAL, but RTLD_GLOBAL instead. Previously, using RTLD_LOCAL, it was already not possible to load C extensions which were not linked to libpython, like C extensions of the standard library built by the "*shared*" section of Modules/Setup. distutils, python-config and python-config.py have been modified.
-rw-r--r--command/build_ext.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/command/build_ext.py b/command/build_ext.py
index 0428466b..1672d02a 100644
--- a/command/build_ext.py
+++ b/command/build_ext.py
@@ -714,20 +714,5 @@ class build_ext(Command):
# don't extend ext.libraries, it may be shared with other
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib]
- else:
- return ext.libraries
- elif sys.platform == 'darwin':
- # Don't use the default code below
- return ext.libraries
- elif sys.platform[:3] == 'aix':
- # Don't use the default code below
- return ext.libraries
- else:
- from distutils import sysconfig
- if sysconfig.get_config_var('Py_ENABLE_SHARED'):
- pythonlib = 'python{}.{}{}'.format(
- sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff,
- sysconfig.get_config_var('ABIFLAGS'))
- return ext.libraries + [pythonlib]
- else:
- return ext.libraries
+
+ return ext.libraries