Commit 645e717e authored by Stefan Behnel's avatar Stefan Behnel

Speed up cpdef method override checks also for Python subclasses with slots by...

Speed up cpdef method override checks also for Python subclasses with slots by assuming that slot attributes themselves never override type fields in the parent class (Python raises an error if you try).
See #2313.
parent 183290fb
......@@ -4349,10 +4349,10 @@ class OverrideCheckNode(StatNode):
# instance at a time.
code.putln("static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;")
code.putln("if (likely("
"Py_TYPE(%s)->tp_dictoffset && "
"Py_TYPE(%s)->tp_dict && "
"tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(%s)->tp_dict) && "
"obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(%s))"
"(!Py_TYPE(%s)->tp_dictoffset || "
"obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(%s)))"
"));" % (
self_arg, self_arg, self_arg, self_arg))
code.putln("else {")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment