On 18 May 2021, at 13:26, Marc-Andre Lemburg <mal@egenix.com> wrote:
On 18.05.2021 13:02, Ronald Oussoren wrote:
If you are embedding a Python with frozen modules, you will need to call the Py_FrozenMain() API from your application's main() (or other entry point within your application).
Removing the export will break such applications. Removing the API from the stable ABI makes it impossible to use the stable ABI from such applications.
Is that intended ? Perhaps I'm missing something.
The discussion is about having a Py_FrozenMain() ABI in a statically linked python executable. That executable cannot be used to create a frozen application because, as you say, those need a custom main function that calls Py_FrozenMain() and should therefore link to libpython (either dynamically or statically).
I lost you there :-)
My bad. I’ll try to be more clear ;-)
The issue that started this discussion thread is that a test that verifies that symbols in the stable ABI are present using ctypes fails when the python interpreter itself is statically linked. That’s because nothing in the interpreter itself references Py_FrozenMain() and hence the symbol doesn’t get included in a statically linked python interpreter.
That’s not really a problem because a frozen binary won’t use the statically linked interpreter anyway.
My understanding is that the ABI defines the exports of libpythonX.X.a and an executable using frozen modules would have to link against this lib. If you remove Py_FrozenMain() from the lib, this no longer works. If you remove Py_FrozenMain() from the stable ABI, your executable would not be able to reference it (when using the stable ABI).
Whether you statically or dynamically link your executable against the lib does not really matter.
Just to clarify: the executable will not be using the standard Python main() entry point.
Note that freeze.py works in exactly this way. It defines its own main(), which then calls Py_FrozenMain(). The frozen.o then gets linked statically at libpythonX.X.a and the set of frozen modules.
Agreed. And because of this Py_FrozenMain should not be removed from the stable ABI of libpython.
Ronald
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Experts (#1, May 18 2021)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs :::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/
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: ronaldoussoren@mac.com
—
Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/