-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Deprecate Py_TRASHCAN_SAFE_BEGIN/END #89037
Comments
The old trashcan macros - Py_TRASHCAN_SAFE_BEGIN/END are unsafe (see bpo-40608). They were removed from the limited C API in 3.9: They should be removed altogether, in favour of Py_TRASHCAN_BEGIN/END. Since they are not documented, I think this would be done by changing the comment before their definition in Include/cpython/object.h. |
Following discussion on python-dev I added a compile-time deprecation warning. With this, and after reverting PR27683 I get the warning below. The build succeeds and the tests pass. % make -s -j2
Objects/frameobject.c:622:5: warning: 'UsingDeprecatedTrashcanMacro' is deprecated [-Wdeprecated-declarations]
Py_TRASHCAN_SAFE_BEGIN(f)
^
./Include/cpython/object.h:545:9: note: expanded from macro 'Py_TRASHCAN_SAFE_BEGIN'
UsingDeprecatedTrashcanMacro cond=1; \
^
./Include/cpython/object.h:542:1: note: 'UsingDeprecatedTrashcanMacro' has been explicitly marked deprecated here
Py_DEPRECATED(3.11) typedef int UsingDeprecatedTrashcanMacro;
^
./Include/pyport.h:509:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^ |
Link to python-dev thread: |
This isn't closed yet because we need a decision whether to issue warnings about Py_TRASHCAN_SAFE_BEGIN/END usage in 3.10 as well. This was suggested by Petr here: I personally don't feel like it's worth going any further than 3.10: Python 3.8 is security fixes only at this point, we haven't received any reports from users about the breakage in 3.9 so far with 3.9.7 around the corner. So the backport is up to Pablo: should we raise the compiler warning on 3.10 as well? |
I prefer to not backport this to 3.10 because technically we cannot introduce new deprecations in an rc and I don't want someone compiling with -Werror to crash between rcs. |
Thanks for your input, Pablo. In this case this can safely be closed. Thank you Irit for finding this and providing the PR! ✨ 🍰 ✨ |
Thanks Irit for making progress on this annoying old C API! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: