Skip to content

Conversation

@picnixz
Copy link
Member

@picnixzpicnixz commented Sep 1, 2025

I'm not sure about kqueue as I can't check this myself. However note the following leak on main:

$ ./python -X showrefcount -c 'import select; s = select.poll(); t = type(s); t._do = s'[74 refs, 43 blocks]

Instead of implementing the full GC protocol, we can make the types immutable.

Rationale for not backporting this: #138341 (comment).

@picnixzpicnixz marked this pull request as draft September 1, 2025 18:56
@picnixzpicnixz changed the title gh-116946: fully implement GC protocol for select.[e]pollgh-116946: correctly support GC for select.[e]pollSep 2, 2025
@picnixzpicnixzforce-pushed the fix/gc/select-heap-types-116946 branch from 50a32c4 to 55c88e4CompareSeptember 2, 2025 08:32
@picnixzpicnixzforce-pushed the fix/gc/select-heap-types-116946 branch from 55c88e4 to 775f809CompareSeptember 2, 2025 08:33
@picnixzpicnixz marked this pull request as ready for review September 2, 2025 08:35
@picnixzpicnixz changed the title gh-116946: correctly support GC for select.[e]pollgh-116946: add Py_TPFLAGS_IMMUTABLETYPE to select.[e]pollSep 2, 2025
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

I don't know if "cannot create cycles as it only contains exact ints" comment is correct or not.

@picnixz
Copy link
MemberAuthor

I don't know if "cannot create cycles as it only contains exact ints" comment is correct or not.

That's why I actually asked. The ints are constructed internally (AFAIU) so I that's why I didn't visit the dictionary. But I can visit it just to be sure.

@kumaraditya303kumaraditya303 enabled auto-merge (squash) September 2, 2025 17:28
@kumaraditya303kumaraditya303 merged commit 3ff00c7 into python:mainSep 2, 2025
45 checks passed
@picnixzpicnixz deleted the fix/gc/select-heap-types-116946 branch September 2, 2025 18:11
lkollar pushed a commit to lkollar/cpython that referenced this pull request Sep 9, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@picnixz@vstinner@kumaraditya303