Skip to content

Conversation

sergey-miryanov
Copy link
Contributor

@sergey-miryanov sergey-miryanov commented Aug 10, 2025

@nascheme It seems that #135552 should be referenced in following text:

 * However, since tp_subclasses started being necessary
 * to invalidate caches (e.g. by PyType_Modified), that clearing has created
 * a bug.  If the weakref to the subclass is cleared before a finalizer is
 * called, the cache may not be correctly invalidated.  That can lead to
 * segfaults since the caches can refer to deallocated objects (GH-135552
 * is an example).

Please take a look.

@sergey-miryanov
Copy link
Contributor Author

This should skip news I believe.

@nascheme
Copy link
Member

Yes, you are correct. GH-91636 is caused by not clearing weakrefs so objects that have tp_clear called on them can later get exposed to Python-level code.

@nascheme nascheme merged commit 654b8d9 into python:main Aug 12, 2025
44 checks passed
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
Sign up for free to 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