Skip to content

Commit 2c0cd18

Browse files
committed
use _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED
1 parent f85b695 commit 2c0cd18

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Modules/_json.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,9 +1750,7 @@ _encoder_iterate_mapping_lock_held(PyEncoderObject *s, PyUnicodeWriter *writer,
17501750
Py_ssize_t indent_level, PyObject *indent_cache,
17511751
PyObject *separator)
17521752
{
1753-
#ifdef Py_GIL_DISABLED
1754-
assert(PyMutex_IsLocked(&items->ob_mutex));
1755-
#endif
1753+
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(items);
17561754
PyObject *key, *value;
17571755
for (Py_ssize_t i = 0; i < PyList_GET_SIZE(items); i++) {
17581756
PyObject *item = PyList_GET_ITEM(items, i);
@@ -1779,9 +1777,7 @@ _encoder_iterate_dict_lock_held(PyEncoderObject *s, PyUnicodeWriter *writer,
17791777
bool *first, PyObject *dct, Py_ssize_t indent_level,
17801778
PyObject *indent_cache, PyObject *separator)
17811779
{
1782-
#ifdef Py_GIL_DISABLED
1783-
assert(PyMutex_IsLocked(&dct->ob_mutex));
1784-
#endif
1780+
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(dct);
17851781
PyObject *key, *value;
17861782
Py_ssize_t pos = 0;
17871783
while (PyDict_Next(dct, &pos, &key, &value)) {

0 commit comments

Comments
 (0)