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

gh-125170: Hard deprecate PyEval_GetLocals in 3.14 #128348

Closed
wants to merge 0 commits into from

Conversation

xuantengh
Copy link
Contributor

@xuantengh xuantengh commented Dec 30, 2024

This PR aims to hard deprecate the PyEval_GetLocals API by emitting a deprecated warning. Meanwhile, this also removes the corresponding tests for the API.

If we consider to deprecate PyFrame_FastToLocals and PyFrame_FastToLocalsWithError as well (mentioned in #125170 (comment)), please let me know. I think they can be done together in this PR.

Copy link

cpython-cla-bot bot commented Dec 31, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@xuantengh xuantengh force-pushed the deprecate-getlocals branch 2 times, most recently from 04e97fb to 36c1cd0 Compare December 31, 2024 06:05
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. I haven't fully considered the uses of PyEval_GetLocals. It might better to mark it for removal "in the future" so we can adjust it, rather than being constrained to 3.16.

Python/ceval.c Outdated
Comment on lines 2602 to 2604
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyEval_GetLocals() is deprecated in Python 3.14 "
"and will be removed in 3.16.", 1)) {
Copy link
Member

Choose a reason for hiding this comment

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

This is the convention for us:

Suggested change
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyEval_GetLocals() is deprecated in Python 3.14 "
"and will be removed in 3.16.", 1)) {
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyEval_GetLocals() is deprecated in Python 3.14 "
"and will be removed in 3.16.", 1) < 0) {

@gaogaotiantian
Copy link
Member

I don't think we ever reached to a conclusion on whether/how/when we deprecate this API. @ncoghlan @markshannon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants