Skip to content

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.

@ghost
Copy link

ghost 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