You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make PyCode_GetFirstFree a PEP-689 unstable API #115756
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.
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?
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?
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?
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?
Activity
erlend-aasland commentedon Feb 21, 2024
PyCode_GetFirstFreewas introduced in PR #100721 (first appeared in 3.12.0a4)encukou commentedon Feb 21, 2024
The name should be
PyUnstable_Code_GetFirstFree(extra underscore).wrongnull commentedon Feb 21, 2024
Shouldn't this apply to
PyCode_GetNumFreetoo?vstinner commentedon 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 commentedon Feb 22, 2024
I'll leave that for the C API WG ;)
encukou commentedon Mar 4, 2024
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 commentedon Mar 6, 2024
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 commentedon Mar 6, 2024
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.
This is the way to do that.
vstinner commentedon Mar 6, 2024
Ping @markshannon
gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781)
encukou commentedon Mar 20, 2024
Thank you!
pythongh-115756: make PyCode_GetFirstFree an unstable API (pythonGH-1…
pythongh-115756: make PyCode_GetFirstFree an unstable API (pythonGH-1…
pythongh-115756: make PyCode_GetFirstFree an unstable API (pythonGH-1…