| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d7befad commit 8c3ecc6
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -277,6 +277,10 @@ the full reference. | |||
| 277 | 277 | | | simply skip the extension. | | | |
| 278 | 278 | +------------------------+--------------------------------+---------------------------+ | |
| 279 | 279 | ||
| 280 | + .. versionchanged:: 3.8 | ||
| 281 | + | ||
| 282 | + On Unix, C extensions are no longer linked to libpython. | ||
| 283 | + | ||
| 280 | 284 | ||
| 281 | 285 | .. class:: Distribution | |
| 282 | 286 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -851,16 +851,19 @@ Changes in the Python API | |||
| 851 | 851 | Changes in the C API | |
| 852 | 852 | -------------------- | |
| 853 | 853 | ||
| 854 | + * On Unix, C extensions are no longer linked to libpython. When Python is | ||
| 855 | + embedded, ``libpython`` must not be loaded with ``RTLD_LOCAL``, but | ||
| 856 | + ``RTLD_GLOBAL`` instead. Previously, using ``RTLD_LOCAL``, it was already not | ||
| 857 | + possible to load C extensions which were not linked to ``libpython``, like C | ||
| 858 | + extensions of the standard library built by the ``*shared*`` section of | ||
| 859 | + ``Modules/Setup``. | ||
| 860 | + | ||
| 854 | 861 | * Use of ``#`` variants of formats in parsing or building value (e.g. | |
| 855 | 862 | :c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`, | |
| 856 | 863 | etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` now. | |
| 857 | 864 | It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail. | |
| 858 | 865 | (Contributed by Inada Naoki in :issue:`36381`.) | |
| 859 | 866 | ||
| 860 | - | ||
| 861 | - Changes in the C API | ||
| 862 | - -------------------------- | ||
| 863 | - | ||
| 864 | 867 | * Instances of heap-allocated types (such as those created with | |
| 865 | 868 | :c:func:`PyType_FromSpec`) hold a reference to their type object. | |
| 866 | 869 | Increasing the reference count of these type objects has been moved from | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -714,20 +714,5 @@ def get_libraries(self, ext): | |||
| 714 | 714 | # don't extend ext.libraries, it may be shared with other | |
| 715 | 715 | # extensions, it is a reference to the original list | |
| 716 | 716 | return ext.libraries + [pythonlib] | |
| 717 | - else: | ||
| 718 | - return ext.libraries | ||
| 719 | - elif sys.platform == 'darwin': | ||
| 720 | - # Don't use the default code below | ||
| 721 | - return ext.libraries | ||
| 722 | - elif sys.platform[:3] == 'aix': | ||
| 723 | - # Don't use the default code below | ||
| 724 | - return ext.libraries | ||
| 725 | - else: | ||
| 726 | - from distutils import sysconfig | ||
| 727 | - if sysconfig.get_config_var('Py_ENABLE_SHARED'): | ||
| 728 | - pythonlib = 'python{}.{}{}'.format( | ||
| 729 | - sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, | ||
| 730 | - sysconfig.get_config_var('ABIFLAGS')) | ||
| 731 | - return ext.libraries + [pythonlib] | ||
| 732 | - else: | ||
| 733 | - return ext.libraries | ||
| 717 | + | ||
| 718 | + return ext.libraries | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1460,7 +1460,7 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c | |||
| 1460 | 1460 | -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ | |
| 1461 | 1461 | $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt | |
| 1462 | 1462 | ||
| 1463 | - python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh | ||
| 1463 | + python-config: $(srcdir)/Misc/python-config.in $(srcdir)/Misc/python-config.sh | ||
| 1464 | 1464 | @ # Substitution happens here, as the completely-expanded BINDIR | |
| 1465 | 1465 | @ # is not available in configure | |
| 1466 | 1466 | sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + On Unix, C extensions are no longer linked to libpython. | ||
| 2 | + | ||
| 3 | + It is now possible to load a C extension built using a shared library Python | ||
| 4 | + with a statically linked Python. | ||
| 5 | + | ||
| 6 | + When Python is embedded, ``libpython`` must not be loaded with ``RTLD_LOCAL``, | ||
| 7 | + but ``RTLD_GLOBAL`` instead. Previously, using ``RTLD_LOCAL``, it was already | ||
| 8 | + not possible to load C extensions which were not linked to ``libpython``, like | ||
| 9 | + C extensions of the standard library built by the ``*shared*`` section of | ||
| 10 | + ``Modules/Setup``. | ||
| 11 | + | ||
| 12 | + distutils, python-config and python-config.py have been modified. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,9 +47,7 @@ for opt in opt_flags: | |||
| 47 | 47 | print(' '.join(flags)) | |
| 48 | 48 | ||
| 49 | 49 | elif opt in ('--libs', '--ldflags'): | |
| 50 | - libs = ['-lpython' + pyver + sys.abiflags] | ||
| 51 | - libs += getvar('LIBS').split() | ||
| 52 | - libs += getvar('SYSLIBS').split() | ||
| 50 | + libs = getvar('LIBS').split() + getvar('SYSLIBS').split() | ||
| 53 | 51 | # add the prefix/lib/pythonX.Y/config dir, but only if there is no | |
| 54 | 52 | # shared library in prefix/lib/. | |
| 55 | 53 | if opt == '--ldflags': | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,7 @@ LIBM="@LIBM@" | |||
| 41 | 41 | LIBC="@LIBC@" | |
| 42 | 42 | SYSLIBS="$LIBM $LIBC" | |
| 43 | 43 | ABIFLAGS="@ABIFLAGS@" | |
| 44 | - LIBS="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS" | ||
| 44 | + LIBS="@LIBS@ $SYSLIBS" | ||
| 45 | 45 | BASECFLAGS="@BASECFLAGS@" | |
| 46 | 46 | LDLIBRARY="@LDLIBRARY@" | |
| 47 | 47 | OPT="@OPT@" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments