@@ -588,9 +588,8 @@ ctype_get_pointer_type(PyObject *self, void *Py_UNUSED(ignored))
588588        return  NULL ;
589589    }
590590
591-     PyObject *  pointer_type  =  FT_ATOMIC_LOAD_PTR_ACQUIRE (info -> pointer_type );
592-     if  (pointer_type ) {
593-         return  Py_NewRef (pointer_type );
591+     if  (info -> pointer_type ) {
592+         return  Py_NewRef (info -> pointer_type );
594593    }
595594    Py_RETURN_NONE ;
596595}
@@ -1228,39 +1227,26 @@ PyCPointerType_SetProto(ctypes_state *st, PyObject *self, StgInfo *stginfo, PyOb
12281227        PyErr_Format (PyExc_TypeError , "%R must have storage info" , proto );
12291228        return  -1 ;
12301229    }
1231- 
1232-     PyObject *  pointer_type  =  FT_ATOMIC_LOAD_PTR_ACQUIRE (info -> pointer_type );
1233-     PyObject *  stginfo_proto  =  FT_ATOMIC_LOAD_PTR_ACQUIRE (stginfo -> proto );
1234- 
1235-     if  (pointer_type  &&  pointer_type  !=  self ) {
1230+     if  (info -> pointer_type  &&  info -> pointer_type  !=  self ) {
12361231        PyErr_Format (PyExc_TypeError ,
12371232            "pointer type already set: old=%R, new=%R" ,
1238-             pointer_type , self );
1233+             info -> pointer_type , self );
12391234        return  -1 ;
12401235    }
1241-     if  (stginfo_proto  &&  stginfo_proto  !=  proto ) {
1236+     if  (stginfo -> proto  &&  stginfo -> proto  !=  proto ) {
12421237        PyErr_Format (PyExc_TypeError ,
12431238            "cls type already set: old=%R, new=%R" ,
1244-             stginfo_proto , proto );
1239+             stginfo -> proto , proto );
12451240        return  -1 ;
12461241    }
12471242
1248-     if  (!stginfo_proto  ||  !pointer_type ) {
1249-         STGINFO2_LOCK (stginfo , info );
1250- 
1251-         stginfo_proto  =  FT_ATOMIC_LOAD_PTR_ACQUIRE (stginfo -> proto );
1252-         if  (!stginfo_proto ) {
1253-             FT_ATOMIC_STORE_PTR_RELEASE (stginfo -> proto , Py_NewRef (proto ));
1254-         }
1255- 
1256-         pointer_type  =  FT_ATOMIC_LOAD_PTR_ACQUIRE (info -> pointer_type );
1257-         if  (!pointer_type ) {
1258-             FT_ATOMIC_STORE_PTR_RELEASE (info -> pointer_type , Py_NewRef (self ));
1259-         }
1260- 
1261-         STGINFO2_UNLOCK ();
1243+     if  (!stginfo -> proto ) {
1244+         stginfo -> proto  =  Py_NewRef (proto );
12621245    }
12631246
1247+     if  (!info -> pointer_type ) {
1248+         info -> pointer_type  =  Py_NewRef (self );
1249+     }
12641250    return  0 ;
12651251}
12661252
0 commit comments