This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients barry, dstufft, eric.araujo, lemburg, loewis, ncoghlan, piotr.dobrogost, pitrou, vstinner
Date 2019-04-25.00:33:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Hmm, apparently the -l flag was added in #832799, for a rather complicated case where the interpreter is linked with a library dlopened by an embedding application (I suppose for some kind of plugin system). The OP there also mentions RTLD_GLOBAL as a workaround (or perhaps the right way of achieving the desired effect).
> (also, the OP didn't mention why he used a shared library build, instead of linking Python statically with the dlopened library)

bpo-34814 is linked to this use case: is an example of Python embedded in C using dlopen("", RTLD_LOCAL | RTLD_NOW). Problem: some C extensions of the standard library cannot be loaded in this case, like _struct.

On Fedora and RHEL, some C extensions like _struct are built by the "*shared*" section of Modules/Setup. In this case, these C extensions are not explicitly linked to libpython.

IHMO it's a bad usage of dlopen(): libpython must always be loaded with RTLD_GLOBAL.

bpo-832799 has been fixed by the following commit which modify distutils to link C extensions to libpython:

commit 10acfd00b28a2aad7b73d35afdbc64b0baebea20
Author: Martin v. Löwis <>
Date:   Mon Apr 10 12:39:36 2006 +0000

    Patch #1429775: Link Python modules to libpython on linux if
    --enable-shared. Fixes #832799.
Date User Action Args
2019-04-25 00:33:15vstinnersetrecipients: + vstinner, lemburg, loewis, barry, ncoghlan, pitrou, eric.araujo, piotr.dobrogost, dstufft
2019-04-25 00:33:15vstinnersetmessageid: <>
2019-04-25 00:33:15vstinnerlinkissue21536 messages
2019-04-25 00:33:15vstinnercreate