Py_FrozenMain and the stable ABI
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
participants (5)
-
Marc-Andre Lemburg -
Nick Coghlan -
Petr Viktorin -
Ronald Oussoren -
Victor Stinner