diff options
author | Christian Tismer <[email protected]> | 2021-05-08 16:06:23 +0200 |
---|---|---|
committer | Christian Tismer <[email protected]> | 2021-08-18 01:20:04 +0200 |
commit | 3a2b7c6f88bba04d8b7ddb571163d23c15c36a4f (patch) | |
tree | 37dce9cb5dd27bca172f02e550a5ea5d2b600888 /sources/pyside6/libpyside/feature_select.cpp | |
parent | 6d07b7256c350835917d30cf74c8180592b80452 (diff) |
py3.10-prep: reset the type cache after feature switching
[ChangeLog][PySide6] Feature switching needs to reset the
internal type cache. This was an omittion that becomes
relevant in Python 3.10 .
When using feature switching in Python 3.10, there were
funny effects where switched and un-switched versions appeared
to co-exist.
It turned out that we were hit by function caching that
is now implemented for the LOAD_ATTR opcode.
It was not known that caching would happen at all for
PySide classes because we don't use Py_TPFLAGS_VALID_VERSION_TAG.
But actually, this flag is used internally by Python to do some
optimizations, and we just have to notify the interpreter of
type changes by PyType_Modified().
Task-number: PYSIDE-1436
Change-Id: Ie8a73f62bd6e9b8156b8ea23626fabd44700158b
Reviewed-by: Cristian Maureira-Fredes <[email protected]>
Diffstat (limited to 'sources/pyside6/libpyside/feature_select.cpp')
-rw-r--r-- | sources/pyside6/libpyside/feature_select.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sources/pyside6/libpyside/feature_select.cpp b/sources/pyside6/libpyside/feature_select.cpp index 492e30c28..8b9834620 100644 --- a/sources/pyside6/libpyside/feature_select.cpp +++ b/sources/pyside6/libpyside/feature_select.cpp @@ -378,6 +378,8 @@ static inline PyObject *SelectFeatureSet(PyTypeObject *type) if (!SelectFeatureSetSubtype(sub_type, select_id)) break; } + // PYSIDE-1436: Clear all caches for the type and subtypes. + PyType_Modified(type); } return type->tp_dict; } |