diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-04-25 18:13:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-25 18:13:10 (GMT) |
commit | 8c3ecc6bacc8d0cd534f2b5b53ed962dd1368c7b (patch) | |
tree | dec5a169a27fde398d57e508f0eb383f1975e418 /Misc | |
parent | d7befad328ad1a6d1f812be2bf154c1cd1e01fbc (diff) | |
download | cpython-8c3ecc6bacc8d0cd534f2b5b53ed962dd1368c7b.zip cpython-8c3ecc6bacc8d0cd534f2b5b53ed962dd1368c7b.tar.gz cpython-8c3ecc6bacc8d0cd534f2b5b53ed962dd1368c7b.tar.bz2 |
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.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Build/2019-04-25-01-51-52.bpo-21536.ACQkiC.rst | 12 | ||||
-rw-r--r-- | Misc/python-config.in | 4 | ||||
-rw-r--r-- | Misc/python-config.sh.in | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/Misc/NEWS.d/next/Build/2019-04-25-01-51-52.bpo-21536.ACQkiC.rst b/Misc/NEWS.d/next/Build/2019-04-25-01-51-52.bpo-21536.ACQkiC.rst new file mode 100644 index 0000000..5e1e717 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-04-25-01-51-52.bpo-21536.ACQkiC.rst @@ -0,0 +1,12 @@ +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. diff --git a/Misc/python-config.in b/Misc/python-config.in index 7144152..31ad558 100644 --- a/Misc/python-config.in +++ b/Misc/python-config.in @@ -47,9 +47,7 @@ for opt in opt_flags: print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): - libs = ['-lpython' + pyver + sys.abiflags] - libs += getvar('LIBS').split() - libs += getvar('SYSLIBS').split() + libs = getvar('LIBS').split() + getvar('SYSLIBS').split() # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in index a3c479c..ac1a467 100644 --- a/Misc/python-config.sh.in +++ b/Misc/python-config.sh.in @@ -41,7 +41,7 @@ LIBM="@LIBM@" LIBC="@LIBC@" SYSLIBS="$LIBM $LIBC" ABIFLAGS="@ABIFLAGS@" -LIBS="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS" +LIBS="@LIBS@ $SYSLIBS" BASECFLAGS="@BASECFLAGS@" LDLIBRARY="@LDLIBRARY@" OPT="@OPT@" |