mirror of
https://github.com/python/cpython.git
synced 2026-01-07 16:02:55 +00:00
gh-127773: Disable attribute cache on incompatible MRO entries (GH-127924)
This commit is contained in:
parent
76ffaef729
commit
aa6579cb60
4 changed files with 50 additions and 2 deletions
|
|
@ -221,7 +221,9 @@ struct _typeobject {
|
|||
PyObject *tp_weaklist; /* not used for static builtin types */
|
||||
destructor tp_del;
|
||||
|
||||
/* Type attribute cache version tag. Added in version 2.6 */
|
||||
/* Type attribute cache version tag. Added in version 2.6.
|
||||
* If zero, the cache is invalid and must be initialized.
|
||||
*/
|
||||
unsigned int tp_version_tag;
|
||||
|
||||
destructor tp_finalize;
|
||||
|
|
@ -229,9 +231,17 @@ struct _typeobject {
|
|||
|
||||
/* bitset of which type-watchers care about this type */
|
||||
unsigned char tp_watched;
|
||||
|
||||
/* Number of tp_version_tag values used.
|
||||
* Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is
|
||||
* disabled for this type (e.g. due to custom MRO entries).
|
||||
* Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).
|
||||
*/
|
||||
uint16_t tp_versions_used;
|
||||
};
|
||||
|
||||
#define _Py_ATTR_CACHE_UNUSED (30000) // (see tp_versions_used)
|
||||
|
||||
/* This struct is used by the specializer
|
||||
* It should be treated as an opaque blob
|
||||
* by code other than the specializer and interpreter. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue