New submission from STINNER Victor <>:

When Python is built without --enable-shared, the "Py_FrozenMain" is not 

When Python is built with --enable-shared, the "Py_FrozenMain" is exported as 

I can reproduce the issue with attached reproduce.tar.gz example:

* exports "func1" symbol
* doesn't export the "func1" symbol

The difference is that links directly two object files (.o) into a 
binary, whereas creates a static library (.a) and then link the 
static library into a binary.

Python is always built with a static library (libpythonVERSION.a) which causes 
the issue.

A solution is to pass -Wl,--whole-archive option to the linker to export *all* 
symbols exported by all object files, and not only export symbols of the object 
files which are used.

I'm not sure why, but "Py_FrozenMain" is the *only* impacted symbol of the 
whole C API.

This issue was discovered by Petr Viktorin who works on the stable ABI:

components: C API
files: reproduce.tar.gz
messages: 393675
nosy: vstinner
priority: normal
severity: normal
status: open
title: "Py_FrozenMain" symbol is not exported
versions: Python 3.11
Added file:

Python tracker <>
Python-bugs-list mailing list

Reply via email to