Skip to content

Commit 56e9a8a

Browse files
committed
Double check that dict hasn't changed after locking it
1 parent 08d14d0 commit 56e9a8a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Python/bytecodes.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,12 @@ dummy_func(
22282228

22292229
PyDictObject *dict = _PyObject_GetManagedDict(owner_o);
22302230
DEOPT_IF(!LOCK_OBJECT(dict));
2231+
#ifdef Py_GIL_DISABLED
2232+
if (dict != _PyObject_GetManagedDict(owner_o)) {
2233+
UNLOCK_OBJECT(dict);
2234+
DEOPT_IF(true);
2235+
}
2236+
#endif
22312237
if (hint >= (size_t)dict->ma_keys->dk_nentries) {
22322238
UNLOCK_OBJECT(dict);
22332239
DEOPT_IF(true);

Python/executor_cases.c.h

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

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)