-
-
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
bpo-40170: Hide implementation detail of Py_TRASHCAN_BEGIN macro #23235
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ab6dc8
Use PyType_GetSlot() in Py_TRASHCAN_BEGIN macro.
shihai1991 b288c3e
add the _PyTrash_cond() function
shihai1991 a0c82d7
apply victor's comment
shihai1991 3d2f872
apply victor's comment
shihai1991 db2d98c
apply victor's comment
shihai1991 477dbd8
apply victor's comment
shihai1991 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/C API/2020-11-13-01-40-28.bpo-40170.uh8lEf.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The ``Py_TRASHCAN_BEGIN`` macro no longer accesses PyTypeObject attributes, | ||
but now can get the condition by calling the new private | ||
:c:func:`_PyTrash_cond()` function which hides implementation details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2134,6 +2134,15 @@ _PyTrash_end(PyThreadState *tstate) | |
} | ||
|
||
|
||
int | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add comment explaining that it is used by the Py_TRASHCAN_BEGIN macro. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, updated. |
||
_PyTrash_cond(void *op_raw, void *dealloc) | ||
{ | ||
PyObject *op = _PyObject_CAST(op_raw); | ||
PyTypeObject *tp = Py_TYPE(op); | ||
return tp->tp_dealloc == (destructor)dealloc; | ||
shihai1991 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
|
||
void _Py_NO_RETURN | ||
_PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg, | ||
const char *file, int line, const char *function) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it's worth it to mention in What's New in Python 3.10. End users will not notice and don't care ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, removed.
I decided add this news because I saw you have written the description info of
_PyTrash_begin()
and_PyTrash_end()
in whatsnew. Lol~There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote a changelog entry, but nothing in What's New in Python 3.9 or What's New in Python 3.10, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I saw this info in https://github.com/python/cpython/blob/master/Misc/NEWS.d/3.9.0a5.rst.
Looks like I confused the news file with relese file : (, sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
I consider that "What's New in Python X.Y" should be short and only describe the public API, but the Changelog should describe every single change and private functions can be mentioned there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, This great. I am very confused when I start write the whatsnew file in the first time.
It's more like a double copy operation.
In fact, I don't know how release manager to archieve those change log.
My simple thought: Maybe we can create some labels to tag what's info should be added in release file or not. When release manager archive those change log, those taged changeinfo chould be archieved in release file automatically.
If this thought have any value, I can add this in my TODO list. Lol~