Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-43795: Remove Py_FrozenMain from the Limited API & Stable ABI #26241

Merged
merged 7 commits into from
May 25, 2021

Conversation

encukou
Copy link
Member

@encukou encukou commented May 19, 2021

Py_FrozenMain was added to the Limited C API in bpo-42591 (3.10.0a4);
but to fix that issue it would be enough to add it to the regular C API.

The function is undocumented, tests were added very recently (bpo-44131),
and most importantly, it is not present in all builds of Python, as
the linker sometimes omits it as unused.
It should be added back when these issues are fixed.

Note that this does not affect Python's regular C API.

https://bugs.python.org/issue43795

Automerge-Triggered-By: GH:encukou

@encukou
Copy link
Member Author

encukou commented May 19, 2021


/* Py_FrozenMain is kept out of the Limited API until documented and present
in all builds of Python */
#ifndef Py_LIMITED_API
PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it into Include/cpython/pylifecycle.h instead.

@@ -0,0 +1,2 @@
:c:func:`Py_FrozenMain`, is no longer considered part of the Limited API and Stable ABI,
to which it was added in 3.10.0a4 (bpo-23730).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py_FrozenMain was part of the limited C API in Python 3.9 and before, I don't get "to which it was added in 3.10.0a4", I understand that you're talking about the stable ABI. Since Python 3.10 is not released yet, maybe remove the Stable ABI part and only mention that you remove Py_FrozenMain from the limited C API? Or just write two sentences to clarify the change ;-)

Also, bpo-23730 is unrelated to Py_FrozenMain.

I like to document changes in the limited C API in https://docs.python.org/dev/whatsnew/3.10.html#c-api-changes (in the Removed section).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I find this sentence from PEP-0384: This PEP proposes to define a stable set of API functions which are guaranteed to be available for the lifetime of Python 3. Do we effect any user when the 3.10 version isn't released?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vstinner, I updated to just a single sentence.
I see "Limited API" as not well defined before 3.10, unlike the Windows stable ABI list. But just noting that it's removed works.

@shihai1991 The trouble is that the set of APIs introduced in PEP 384 wasn't maintained the way the PEP intended.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for documenting the removal.

I just have a comment about the What's New entry. Feel free to change it or not.

@@ -1919,6 +1919,11 @@ Porting to Python 3.10
instead.
(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)

* The undocumented function ``Py_FrozenMain`` has been removed from the
limited API. The function is mainly useful for custom builds of Python,
and it is not always present when Python is built as a shared library.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"when Python is built as a shared library" the symbol is exported, do you mean the opposite? Maybe omit this sentence since I would like this issue to be fixed :-D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll remove it. But the fix could reword this, too :)

Doc/whatsnew/3.10.rst Outdated Show resolved Hide resolved
@miss-islington
Copy link
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@encukou encukou deleted the pep652-no-frozenmain branch May 25, 2021 11:42
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2021
…thonGH-26241)

Py_FrozenMain was added to the Limited C API in [bpo-42591]() (3.10.0a4);
but to fix that issue it would be enough to add it to the regular C API.

The function is undocumented, tests were added very recently ([bpo-44131]()),
and most importantly, it is not present in all builds of Python, as
the linker sometimes omits it as unused.
It should be added back when these issues are fixed.

Note that this does not affect Python's regular C API.
(cherry picked from commit d168569)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou
Copy link
Member Author

encukou commented May 25, 2021

Thanks for the review!

@bedevere-bot
Copy link

GH-26353 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label May 25, 2021
pablogsal pushed a commit that referenced this pull request May 25, 2021
…-26241) (GH-26353)

Py_FrozenMain was added to the Limited C API in [bpo-42591]() (3.10.0a4);
but to fix that issue it would be enough to add it to the regular C API.

The function is undocumented, tests were added very recently ([bpo-44131]()),
and most importantly, it is not present in all builds of Python, as
the linker sometimes omits it as unused.
It should be added back when these issues are fixed.

Note that this does not affect Python's regular C API.
(cherry picked from commit d168569)

Co-authored-by: Petr Viktorin <encukou@gmail.com>

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants