mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-104405: Add missing PEP 523 checks (GH-104406)
This commit is contained in:
parent
a10b026f0f
commit
1eb950ca55
6 changed files with 505 additions and 420 deletions
|
@ -494,6 +494,7 @@ dummy_func(
|
|||
}
|
||||
|
||||
inst(BINARY_SUBSCR_GETITEM, (unused/1, container, sub -- unused)) {
|
||||
DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR);
|
||||
PyTypeObject *tp = Py_TYPE(container);
|
||||
DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR);
|
||||
PyHeapTypeObject *ht = (PyHeapTypeObject *)tp;
|
||||
|
@ -830,8 +831,9 @@ dummy_func(
|
|||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
#endif /* ENABLE_SPECIALIZATION */
|
||||
assert(frame != &entry_frame);
|
||||
if ((Py_TYPE(receiver) == &PyGen_Type ||
|
||||
Py_TYPE(receiver) == &PyCoro_Type) && ((PyGenObject *)receiver)->gi_frame_state < FRAME_EXECUTING)
|
||||
if ((tstate->interp->eval_frame == NULL) &&
|
||||
(Py_TYPE(receiver) == &PyGen_Type || Py_TYPE(receiver) == &PyCoro_Type) &&
|
||||
((PyGenObject *)receiver)->gi_frame_state < FRAME_EXECUTING)
|
||||
{
|
||||
PyGenObject *gen = (PyGenObject *)receiver;
|
||||
_PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe;
|
||||
|
@ -867,6 +869,7 @@ dummy_func(
|
|||
}
|
||||
|
||||
inst(SEND_GEN, (unused/1, receiver, v -- receiver, unused)) {
|
||||
DEOPT_IF(tstate->interp->eval_frame, SEND);
|
||||
PyGenObject *gen = (PyGenObject *)receiver;
|
||||
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type &&
|
||||
Py_TYPE(gen) != &PyCoro_Type, SEND);
|
||||
|
@ -2331,6 +2334,7 @@ dummy_func(
|
|||
}
|
||||
|
||||
inst(FOR_ITER_GEN, (unused/1, iter -- iter, unused)) {
|
||||
DEOPT_IF(tstate->interp->eval_frame, FOR_ITER);
|
||||
PyGenObject *gen = (PyGenObject *)iter;
|
||||
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER);
|
||||
DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue