@@ -236,7 +236,7 @@ should_audit(PyInterpreterState *interp)
236236 return 0 ;
237237 }
238238 return (interp -> runtime -> audit_hooks .head
239- || FT_ATOMIC_LOAD_PTR_ACQUIRE ( interp -> audit_hooks )
239+ || interp -> audit_hooks
240240 || PyDTrace_AUDIT_ENABLED ());
241241}
242242
@@ -306,14 +306,13 @@ sys_audit_tstate(PyThreadState *ts, const char *event,
306306 }
307307
308308 /* Call interpreter hooks */
309- PyObject * audit_hooks = FT_ATOMIC_LOAD_PTR_ACQUIRE (is -> audit_hooks );
310- if (audit_hooks ) {
309+ if (is -> audit_hooks ) {
311310 eventName = PyUnicode_FromString (event );
312311 if (!eventName ) {
313312 goto exit ;
314313 }
315314
316- hooks = PyObject_GetIter (audit_hooks );
315+ hooks = PyObject_GetIter (is -> audit_hooks );
317316 if (!hooks ) {
318317 goto exit ;
319318 }
@@ -537,29 +536,20 @@ sys_addaudithook_impl(PyObject *module, PyObject *hook)
537536 }
538537
539538 PyInterpreterState * interp = tstate -> interp ;
540- PyMutex mutex = interp -> audit_hooks_mutex ;
541- PyMutex_Lock (& mutex );
542-
543539 if (interp -> audit_hooks == NULL ) {
544- PyObject * new_list = PyList_New (0 );
545- if (new_list == NULL ) {
546- goto error ;
540+ interp -> audit_hooks = PyList_New (0 );
541+ if (interp -> audit_hooks == NULL ) {
542+ return NULL ;
547543 }
548544 /* Avoid having our list of hooks show up in the GC module */
549- PyObject_GC_UnTrack (new_list );
550- FT_ATOMIC_STORE_PTR_RELEASE (interp -> audit_hooks , new_list );
545+ PyObject_GC_UnTrack (interp -> audit_hooks );
551546 }
552547
553548 if (PyList_Append (interp -> audit_hooks , hook ) < 0 ) {
554- goto error ;
549+ return NULL ;
555550 }
556551
557- PyMutex_Unlock (& mutex );
558552 Py_RETURN_NONE ;
559-
560- error :
561- PyMutex_Unlock (& mutex );
562- return NULL ;
563553}
564554
565555/*[clinic input]
0 commit comments