Skip to content

Commit 8e84dd4

Browse files
committed
Add a lock in the _SEND instruction
1 parent 3a1fe3a commit 8e84dd4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Python/bytecodes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ dummy_func(
11051105
((PyGenObject *)receiver_o)->gi_frame_state < FRAME_EXECUTING)
11061106
{
11071107
PyGenObject *gen = (PyGenObject *)receiver_o;
1108+
Py_BEGIN_CRITICAL_SECTION(gen);
11081109
_PyInterpreterFrame *gen_frame = &gen->gi_iframe;
11091110
STACK_SHRINK(1);
11101111
_PyFrame_StackPush(gen_frame, v);
@@ -1115,6 +1116,7 @@ dummy_func(
11151116
frame->return_offset = (uint16_t)(INSTRUCTION_SIZE + oparg);
11161117
assert(gen_frame->previous == NULL);
11171118
gen_frame->previous = frame;
1119+
Py_END_CRITICAL_SECTION();
11181120
DISPATCH_INLINED(gen_frame);
11191121
}
11201122
if (PyStackRef_Is(v, PyStackRef_None) && PyIter_Check(receiver_o)) {

Python/generated_cases.c.h

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)