GeezerVison is showing github.com — Make PyCode_GetFirstFree a PEP-689 unstable API · Issue #115756 · python/cpython
Make PyCode_GetFirstFree a PEP-689 unstable API #115756Description
It was and it wasn't. We don't really want to expose it, but if we don't then Cython and other C extensions will access the internal fields directly, which is worse.
Now that we have an unstable API, it should probably be part of that.
I'd like all code object C APIs to be unstable, but it's probably too late for that.
Maybe rename it to PyUnstableCode_GetFirstFree?
Originally posted by @markshannon in #115654 (comment)
Linked PRs
Activityerlend-aasland commented on Feb 21, 2024 ContributorAuthor More actions PyCode_GetFirstFree was introduced in PR #100721 (first appeared in 3.12.0a4)
encukou commented on Feb 21, 2024 The name should be PyUnstable_Code_GetFirstFree (extra underscore). Reacted by Bogdan Romanyuk and Erlend E. Aasland wrongnull commented on Feb 21, 2024 Shouldn't this apply to PyCode_GetNumFree too? vstinner commented on Feb 22, 2024 The function is part of Python 3.12 release, and after Python 3.12, you want to downgrade the API to the unstable API in Python 3.13? It sounds too late for me, no? erlend-aasland commented on Feb 22, 2024 ContributorAuthor More actions
The function is part of Python 3.12 release, and after Python 3.12, you want to downgrade the API to the unstable API in Python 3.13? It sounds too late for me, no?
I'll leave that for the C API WG ;) encukou commented on Mar 4, 2024
The function is part of Python 3.12 release, and after Python 3.12, you want to downgrade the API to the unstable API in Python 3.13? It sounds too late for me, no?
Downgrading means that the public name, PyCode_GetFirstFree, will be deprecated, but will be kept until the function's signature/behaviour changes (minimum 2 releases).
Do you think this should not be done? vstinner commented on Mar 6, 2024
Do you think this should not be done?
I don't think that it's worth it. If later, the function becomes stable, depending on the Python version, PyCode_GetFirstFree() may be deprecated or not, it sounds unpleasant for a minor issue.
Honestly, just elaborate the documentation to express more clearly the stability contract, no? encukou commented on Mar 6, 2024
If later, the function becomes stable
I don't think the intention is to ever make it stable. It exposes an implementation detail: free variables follow other ones in a code object.
just elaborate the documentation to express more clearly the stability contract
This is the way to do that. Reacted by Erlend E. Aasland vstinner commented on Mar 6, 2024 encukou commented on Mar 20, 2024 Reacted by Erlend E. Aasland
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|