diff options
author | Donghee Na <donghee.na@python.org> | 2024-12-03 00:14:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-03 00:14:40 +0900 |
commit | 7c2bd9b2266665ff4010b6c6c175bab18e08e4f8 (patch) | |
tree | 83fa851c015d5c6ebe95a873fb4134f61ee478e1 /Python/bytecodes.c | |
parent | 3e812253ab6b2f98fc5d17bfb82947e392b0b2a2 (diff) | |
download | cpython-7c2bd9b2266665ff4010b6c6c175bab18e08e4f8.tar.gz cpython-7c2bd9b2266665ff4010b6c6c175bab18e08e4f8.zip |
gh-115999: Use light-weight lock for UNPACK_SEQUENCE_LIST (gh-127514)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index c07ec42ec68..e96674c3502 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1438,14 +1438,9 @@ dummy_func( inst(UNPACK_SEQUENCE_LIST, (unused/1, seq -- values[oparg])) { PyObject *seq_o = PyStackRef_AsPyObjectBorrow(seq); DEOPT_IF(!PyList_CheckExact(seq_o)); - #ifdef Py_GIL_DISABLED - PyCriticalSection cs; - PyCriticalSection_Begin(&cs, seq_o); - #endif + DEOPT_IF(!LOCK_OBJECT(seq_o)); if (PyList_GET_SIZE(seq_o) != oparg) { - #ifdef Py_GIL_DISABLED - PyCriticalSection_End(&cs); - #endif + UNLOCK_OBJECT(seq_o); DEOPT_IF(true); } STAT_INC(UNPACK_SEQUENCE, hit); @@ -1453,9 +1448,7 @@ dummy_func( for (int i = oparg; --i >= 0; ) { *values++ = PyStackRef_FromPyObjectNew(items[i]); } - #ifdef Py_GIL_DISABLED - PyCriticalSection_End(&cs); - #endif + UNLOCK_OBJECT(seq_o); DECREF_INPUTS(); } |