@@ -375,12 +375,9 @@ typedef struct CFieldObject {
375375*****************************************************************/
376376
377377typedef struct {
378- #ifdef Py_GIL_DISABLED
379- PyMutex mutex ; /* critical section mutex */
380- #endif
381378 int initialized ;
382379 Py_ssize_t size ; /* number of bytes */
383- Py_ssize_t align ; /* alignment requirements */
380+ Py_ssize_t align ; /* alignment reqwuirements */
384381 Py_ssize_t length ; /* number of fields */
385382 ffi_type ffi_type_pointer ;
386383 PyObject * proto ; /* Only for Pointer/ArrayObject */
@@ -395,16 +392,20 @@ typedef struct {
395392 PyObject * checker ;
396393 PyObject * module ;
397394 int flags ; /* calling convention and such */
398- int dict_final ;
395+ #ifdef Py_GIL_DISABLED
396+ PyMutex mutex ; /* critical section mutex */
397+ #endif
398+ uint8_t dict_final ;
399399
400400 /* pep3118 fields, pointers need PyMem_Free */
401401 char * format ;
402402 int ndim ;
403403 Py_ssize_t * shape ;
404- /* Py_ssize_t *strides; */ /* unused in ctypes */
405- /* Py_ssize_t *suboffsets; */ /* unused in ctypes */
404+ /* Py_ssize_t *strides; */ /* unused in ctypes */
405+ /* Py_ssize_t *suboffsets; */ /* unused in ctypes */
406406} StgInfo ;
407407
408+
408409/*
409410 To ensure thread safety in the free threading build, the `STGINFO_LOCK` and
410411 `STGINFO_UNLOCK` macros use critical sections to protect against concurrent
@@ -422,17 +423,17 @@ typedef struct {
422423#define STGINFO_LOCK (stginfo ) Py_BEGIN_CRITICAL_SECTION_MUT(&(stginfo)->mutex)
423424#define STGINFO_UNLOCK () Py_END_CRITICAL_SECTION()
424425
425- static inline int
426+ static inline uint8_t
426427stginfo_get_dict_final (StgInfo * info )
427428{
428- return FT_ATOMIC_LOAD_INT (info -> dict_final );
429+ return FT_ATOMIC_LOAD_UINT8 (info -> dict_final );
429430}
430431
431432static inline void
432433stginfo_set_dict_final_lock_held (StgInfo * info )
433434{
434435 _Py_CRITICAL_SECTION_ASSERT_MUTEX_LOCKED (& info -> mutex );
435- FT_ATOMIC_STORE_INT (info -> dict_final , 1 );
436+ FT_ATOMIC_STORE_UINT8 (info -> dict_final , 1 );
436437}
437438
438439
0 commit comments