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

bpo-40170: Hide implementation detail of Py_TRASHCAN_BEGIN macro #23235

Merged
merged 6 commits into from
Nov 24, 2020

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Nov 11, 2020

@shihai1991
Copy link
Member Author

cc @vstinner

Include/cpython/object.h Outdated Show resolved Hide resolved
@shihai1991 shihai1991 changed the title bpo-40170: Use PyType_GetSlot() in Py_TRASHCAN_BEGIN macro. bpo-40170: Hide implementation detail of Py_TRASHCAN_BEGIN macro Nov 12, 2020
Include/cpython/object.h Outdated Show resolved Hide resolved
Include/cpython/object.h Outdated Show resolved Hide resolved
* 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.
(Contributed by Hai Shi in :issue:`40170`.)
Copy link
Member

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 ;-)

Copy link
Member Author

@shihai1991 shihai1991 Nov 13, 2020

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~

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

@shihai1991 shihai1991 Nov 13, 2020

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~

Include/cpython/object.h Outdated Show resolved Hide resolved
Objects/object.c Outdated Show resolved Hide resolved
Objects/object.c Outdated Show resolved Hide resolved
@shihai1991
Copy link
Member Author

@vstinner Hi, victor. Is this PR good enough to be merged?

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM, but please address my last minor request (just add a comment).

@@ -2134,6 +2134,13 @@ _PyTrash_end(PyThreadState *tstate)
}


int
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it, updated.

@vstinner vstinner merged commit ed1a5a5 into python:master Nov 24, 2020
@vstinner
Copy link
Member

Merged, thanks.

@shihai1991
Copy link
Member Author

Thanks, victor.

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
The Py_TRASHCAN_BEGIN macro no longer accesses PyTypeObject attributes,
but now can get the condition by calling the new private
_PyTrash_cond() function which hides implementation details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants