gh-101277: Isolate itertools, part 3/4 by erlend-aasland · Pull Request #101304 · python/cpython
@kumaraditya303: we're failing test_finalize_structseq of test_embed. the type version contract is invalidated1 and the Py_TPFLAGS_VALID_VERSION_TAG assert in _PyType_Lookup is triggered here:
| if (entry->version == type->tp_version_tag && | |
| entry->name == name) { | |
| assert(_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)); | |
| OBJECT_STAT_INC_COND(type_cache_hits, !is_dunder_name(name)); | |
| OBJECT_STAT_INC_COND(type_cache_dunder_hits, is_dunder_name(name)); | |
| return entry->value; | |
| } |
AFAICS, the contract between tp_version_tag and Py_TPFLAGS_VALID_VERSION_TAG seems to hold all across the APIs2 implemented typeobject.c, and from what I can see, the runtime uses only these APIs to mess with the type version.
Any ideas?