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 encukou requested review from vstinner and pablogsal May 19, 2021
@encukou encukou requested a review from python/windows-team as a code owner May 19, 2021
@encukou encukou force-pushed the encukou:pep652-no-frozenmain branch from 215efd4 to dac5c8c 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);

This comment has been minimized.

@vstinner

vstinner May 20, 2021
Member

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).

This comment has been minimized.

@vstinner

vstinner May 20, 2021
Member

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).

This comment has been minimized.

@shihai1991

shihai1991 May 20, 2021
Member

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?

This comment has been minimized.

@encukou

encukou May 21, 2021
Author Member

@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

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.

This comment has been minimized.

@vstinner

vstinner May 25, 2021
Member

"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

This comment has been minimized.

@encukou

encukou May 25, 2021
Author Member

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

Doc/whatsnew/3.10.rst Outdated Show resolved Hide resolved
@miss-islington miss-islington merged commit d168569 into python:main May 25, 2021
12 checks passed
12 checks passed
@github-actions
Docs
Details
@github-actions
Check for source changes
Details
@github-actions
Check if generated files are up to date
Details
@github-actions
Windows (x86)
Details
@github-actions
Windows (x64)
Details
@github-actions
macOS
Details
@github-actions
Ubuntu
Details
@github-actions
Ubuntu SSL tests with OpenSSL
Details
Azure Pipelines PR #20210525.22 succeeded
Details
@travis-ci
Travis CI - Pull Request Build Passed
Details
@bedevere-bot
bedevere/issue-number Issue number 43795 found
Details
@bedevere-bot
bedevere/news News entry found in Misc/NEWS.d
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 25, 2021

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

@encukou encukou deleted the encukou:pep652-no-frozenmain branch May 25, 2021
miss-islington added 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 encukou commented May 25, 2021

Thanks for the review!

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 25, 2021

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

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
Projects
None yet
6 participants