Skip to content

gh-112529: Stop the world around gc.get_referents - #114823

Merged
colesbury merged 3 commits into
python:mainfrom
colesbury:gh-112529-get-referents
Feb 6, 2024
Merged

gh-112529: Stop the world around gc.get_referents#114823
colesbury merged 3 commits into
python:mainfrom
colesbury:gh-112529-get-referents

Conversation

@colesbury

@colesburycolesbury commented Jan 31, 2024

Copy link
Copy Markdown
Contributor

We do not want to add locking in tp_traverse slot implementations. Instead, stop-the-world when calling gc.get_referents. Note that the the stop-the-world call is a no-op in the default build.

We do not want to add locking in tp_traverse slot implementations.
Instead, stop-the-world when calling gc.get_referents. Note that the the
stop-the-world call is a no-op in the default build.

@pablogsalpablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Left a small nit, feel free to ignore

Comment threadModules/gcmodule.c Outdated
Comment threadModules/gcmodule.c
PyObject *obj = PyTuple_GET_ITEM(args, i);

if (!_PyObject_IS_GC(obj))
continue;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small nit: Do you mind adding braces here to conform with PEP 7? (I know we are just moving code around but now that we are changing it it's a good opportunity)

colesburyand others added 2 commits February 1, 2024 11:33
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
@colesbury
colesbury merged commit 7fdd423 into python:mainFeb 6, 2024
@colesbury
colesbury deleted the gh-112529-get-referents branch February 6, 2024 16:45
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
We do not want to add locking in `tp_traverse` slot implementations.
Instead, stop the world when calling `gc.get_referents`. Note that the the
stop the world call is a no-op in the default build.
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Sign up for freeto 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

@colesbury@DinoV@pablogsal