@@ -2343,11 +2343,11 @@ test_get_incomplete_frame(void)
23432343}
23442344
23452345static void
2346- do_gilstate_ensure (void * semaphore_ptr )
2346+ do_gilstate_ensure (void * event_ptr )
23472347{
2348- _PySemaphore * semaphore = (_PySemaphore * )semaphore_ptr ;
2348+ PyEvent * event = (PyEvent * )event_ptr ;
23492349 // Signal to the calling thread that we've started
2350- _PySemaphore_Wakeup ( semaphore );
2350+ _PyEvent_Notify ( event );
23512351 PyGILState_Ensure (); // This should hang
23522352 assert (NULL );
23532353}
@@ -2359,15 +2359,13 @@ test_gilstate_after_finalization(void)
23592359 Py_Finalize ();
23602360 PyThread_handle_t handle ;
23612361 PyThread_ident_t ident ;
2362- _PySemaphore semaphore ;
2363- _PySemaphore_Init (& semaphore );
2364- if (PyThread_start_joinable_thread (& do_gilstate_ensure , & semaphore , & ident , & handle ) < 0 ) {
2362+ PyEvent event = {};
2363+ if (PyThread_start_joinable_thread (& do_gilstate_ensure , & event , & ident , & handle ) < 0 ) {
23652364 return -1 ;
23662365 }
2367- _PySemaphore_Wait ( & semaphore , /*timeout_ns=*/ -1 , /*detach=*/ 0 );
2366+ PyEvent_Wait ( & event );
23682367 // We're now pretty confident that the thread went for
23692368 // PyGILState_Ensure(), but that means it got hung.
2370- _PySemaphore_Destroy (& semaphore );
23712369 return PyThread_detach_thread (handle );
23722370}
23732371
0 commit comments