mirror of
https://github.com/python/cpython.git
synced 2026-06-08 02:41:11 +00:00
gh-143732: allow dict subclasses to be specialized (GH-148128)
This commit is contained in:
parent
de1769f700
commit
5847931d11
15 changed files with 461 additions and 206 deletions
|
|
@ -1595,7 +1595,9 @@ _Py_Specialize_StoreSubscr(_PyStackRef container_st, _PyStackRef sub_st, _Py_COD
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (container_type == &PyDict_Type) {
|
||||
if (container_type->tp_as_mapping != NULL &&
|
||||
container_type->tp_as_mapping->mp_ass_subscript == _PyDict_StoreSubscript)
|
||||
{
|
||||
specialize(instr, STORE_SUBSCR_DICT);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2429,7 +2431,9 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
|
|||
}
|
||||
}
|
||||
}
|
||||
if (PyAnyDict_CheckExact(lhs)) {
|
||||
if (Py_TYPE(lhs)->tp_as_mapping != NULL &&
|
||||
Py_TYPE(lhs)->tp_as_mapping->mp_subscript == _PyDict_Subscript)
|
||||
{
|
||||
specialize(instr, BINARY_OP_SUBSCR_DICT);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue