@@ -974,20 +974,19 @@ _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name,
974
974
// Fall through.
975
975
} // Else owner is maybe a builtin with no dict, or __slots__. Doesn't matter.
976
976
977
- /* `descr` is borrowed. Just check tp_version_tag before accessing in case
978
- * it's deleted. This is safe for methods (even inherited ones from super
979
- * classes!) as long as tp_version_tag is validated for two main reasons:
977
+ /* `descr` is borrowed. This is safe for methods (even inherited ones from
978
+ * super classes!) as long as tp_version_tag is validated for two main reasons:
980
979
*
981
980
* 1. The class will always hold a reference to the method so it will
982
981
* usually not be GC-ed. Should it be deleted in Python, e.g.
983
982
* `del obj.meth`, tp_version_tag will be invalidated, because of reason 2.
984
983
*
985
984
* 2. The pre-existing type method cache (MCACHE) uses the same principles
986
- * of caching a borrowed descriptor. It does all the heavy lifting for us.
987
- * E.g. it invalidates on any MRO modification, on any type object
988
- * change along said MRO, etc. (see PyType_Modified usages in typeobject.c).
989
- * The type method cache has been working since Python 2.6 and it's
990
- * battle-tested.
985
+ * of caching a borrowed descriptor. The MCACHE infrastructure does all the
986
+ * heavy lifting for us. E.g. it invalidates tp_version_tag on any MRO
987
+ * modification, on any type object change along said MRO, etc. (see
988
+ * PyType_Modified usages in typeobject.c). The MCACHE has been
989
+ * working since Python 2.6 and it's battle-tested.
991
990
*/
992
991
cache2 -> obj = descr ;
993
992
cache1 -> dk_version_or_hint = keys_version ;
0 commit comments