Skip to content

Commit eb5179f

Browse files
corona10ebonnal
authored andcommitted
pythongh-115999: Use light-weight lock for UNPACK_SEQUENCE_LIST (pythongh-127514)
1 parent 0b6ef61 commit eb5179f

File tree

5 files changed

+14
-44
lines changed

5 files changed

+14
-44
lines changed

Include/internal/pycore_opcode_metadata.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -1438,24 +1438,17 @@ dummy_func(
14381438
inst(UNPACK_SEQUENCE_LIST, (unused/1, seq -- values[oparg])) {
14391439
PyObject *seq_o = PyStackRef_AsPyObjectBorrow(seq);
14401440
DEOPT_IF(!PyList_CheckExact(seq_o));
1441-
#ifdef Py_GIL_DISABLED
1442-
PyCriticalSection cs;
1443-
PyCriticalSection_Begin(&cs, seq_o);
1444-
#endif
1441+
DEOPT_IF(!LOCK_OBJECT(seq_o));
14451442
if (PyList_GET_SIZE(seq_o) != oparg) {
1446-
#ifdef Py_GIL_DISABLED
1447-
PyCriticalSection_End(&cs);
1448-
#endif
1443+
UNLOCK_OBJECT(seq_o);
14491444
DEOPT_IF(true);
14501445
}
14511446
STAT_INC(UNPACK_SEQUENCE, hit);
14521447
PyObject **items = _PyList_ITEMS(seq_o);
14531448
for (int i = oparg; --i >= 0; ) {
14541449
*values++ = PyStackRef_FromPyObjectNew(items[i]);
14551450
}
1456-
#ifdef Py_GIL_DISABLED
1457-
PyCriticalSection_End(&cs);
1458-
#endif
1451+
UNLOCK_OBJECT(seq_o);
14591452
DECREF_INPUTS();
14601453
}
14611454

Python/executor_cases.c.h

+6-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

+3-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)