Hi Petr,
I reproduced the issue with Python is built without --enable-shared.
But when Python is built with --enable-shared, Py_FrozenMain() is exported as expected!
I created https://bugs.python.org/issue44133 and https://github.com/python/cpython/pull/26130 to fix the issue.
Victor
On Wed, May 5, 2021 at 3:18 PM Petr Viktorin <encukou@gmail.com> wrote:
I tried getting Py_FrozenMain from ctypes.pythonapi, but I get "undefined symbol". This is the only symbol from the Stable ABI that behaves this way. (It was re-added in bpo-42591.) So far, I haven't found what makes the symbol different, but I assume this is deliberate, since it happens on Windows as well (see a test PR). It seems to be included when Python is compiled as a shared library.
Is this something we want as part of the stable ABI? If we do, it would be good to always export it. AFAICS, Py_FrozenMain is only used with freeze.py for a custom Python build with frozen modules included.
$ ./python Python 3.11.0a0 (heads/pep652-ctypes:315d97b64aa, May 5 2021, 11:49:17) [GCC 11.1.1 20210428 (Red Hat 11.1.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information.
import ctypes ctypes.pythonapi.Py_FrozenMain Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/pviktori/dev/cpython/Lib/ctypes/__init__.py", line 387, in __getattr__ func = self.__getitem__(name) File "/home/pviktori/dev/cpython/Lib/ctypes/__init__.py", line 392, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: ./python: undefined symbol: Py_FrozenMain
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org https://mail.python.org/mailman3/lists/capi-sig.python.org/ Member address: vstinner@python.org
-- Night gathers, and now my watch begins. It shall not end until my death.