@@ -154,14 +154,18 @@ ASSERT_DICT_LOCKED(PyObject *op)
154
154
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED (op );
155
155
}
156
156
#define ASSERT_DICT_LOCKED (op ) ASSERT_DICT_LOCKED(_Py_CAST(PyObject*, op))
157
- #define ASSERT_WORLD_STOPPED_OR_DICT_LOCKED (op ) \
158
- if (!_PyInterpreterState_GET()->stoptheworld.world_stopped) { \
159
- ASSERT_DICT_LOCKED(op); \
160
- }
161
- #define ASSERT_WORLD_STOPPED_OR_OBJ_LOCKED (op ) \
162
- if (!_PyInterpreterState_GET()->stoptheworld.world_stopped) { \
163
- _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(op); \
164
- }
157
+ #define ASSERT_WORLD_STOPPED_OR_DICT_LOCKED (OP ) \
158
+ do { \
159
+ if (!_PyInterpreterState_GET()->stoptheworld.world_stopped) { \
160
+ ASSERT_DICT_LOCKED(OP); \
161
+ } \
162
+ } while (0)
163
+ #define ASSERT_WORLD_STOPPED_OR_OBJ_LOCKED (OP ) \
164
+ do { \
165
+ if (!_PyInterpreterState_GET()->stoptheworld.world_stopped) { \
166
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(OP); \
167
+ } \
168
+ } while (0)
165
169
166
170
#define IS_DICT_SHARED (mp ) _PyObject_GC_IS_SHARED(mp)
167
171
#define SET_DICT_SHARED (mp ) _PyObject_GC_SET_SHARED(mp)
@@ -170,15 +174,19 @@ ASSERT_DICT_LOCKED(PyObject *op)
170
174
#define ASSERT_OWNED_OR_SHARED (mp ) \
171
175
assert(_Py_IsOwnedByCurrentThread((PyObject *)mp) || IS_DICT_SHARED(mp));
172
176
173
- #define LOCK_KEYS_IF_SPLIT (keys , kind ) \
174
- if (kind == DICT_KEYS_SPLIT) { \
175
- LOCK_KEYS(keys); \
176
- }
177
-
178
- #define UNLOCK_KEYS_IF_SPLIT (keys , kind ) \
179
- if (kind == DICT_KEYS_SPLIT) { \
180
- UNLOCK_KEYS(keys); \
181
- }
177
+ #define LOCK_KEYS_IF_SPLIT (KEYS , KIND ) \
178
+ do { \
179
+ if (KIND == DICT_KEYS_SPLIT) { \
180
+ LOCK_KEYS(KEYS); \
181
+ } \
182
+ } while (0)
183
+
184
+ #define UNLOCK_KEYS_IF_SPLIT (KEYS , KIND ) \
185
+ do { \
186
+ if (KIND == DICT_KEYS_SPLIT) { \
187
+ UNLOCK_KEYS(KEYS); \
188
+ } \
189
+ } while (0)
182
190
183
191
static inline Py_ssize_t
184
192
load_keys_nentries (PyDictObject * mp )
0 commit comments