@@ -424,18 +424,18 @@ test_critical_sections_stw(PyObject *self, PyObject *Py_UNUSED(args))
424424 //
425425 // With the fix, the STW requester detects world_stopped and skips locking.
426426
427- const Py_ssize_t NUM_THREADS = 2 ;
427+ #define STW_NUM_THREADS 2
428428 struct test_data_stw test_data = {
429429 .obj = PyDict_New (),
430- .num_threads = NUM_THREADS ,
430+ .num_threads = STW_NUM_THREADS ,
431431 };
432432 if (test_data .obj == NULL ) {
433433 return NULL ;
434434 }
435435
436- PyThread_handle_t handles [NUM_THREADS ];
437- PyThread_ident_t idents [NUM_THREADS ];
438- for (Py_ssize_t i = 0 ; i < NUM_THREADS ; i ++ ) {
436+ PyThread_handle_t handles [STW_NUM_THREADS ];
437+ PyThread_ident_t idents [STW_NUM_THREADS ];
438+ for (Py_ssize_t i = 0 ; i < STW_NUM_THREADS ; i ++ ) {
439439 PyThread_start_joinable_thread (& thread_stw , & test_data ,
440440 & idents [i ], & handles [i ]);
441441 }
@@ -454,9 +454,10 @@ test_critical_sections_stw(PyObject *self, PyObject *Py_UNUSED(args))
454454
455455 _PyEval_StartTheWorld (interp );
456456
457- for (Py_ssize_t i = 0 ; i < NUM_THREADS ; i ++ ) {
457+ for (Py_ssize_t i = 0 ; i < STW_NUM_THREADS ; i ++ ) {
458458 PyThread_join_thread (handles [i ]);
459459 }
460+ #undef STW_NUM_THREADS
460461 Py_DECREF (test_data .obj );
461462 Py_RETURN_NONE ;
462463}
0 commit comments