@@ -2101,48 +2101,50 @@ statresult_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
21012101static  int 
21022102_posix_clear (PyObject  * module )
21032103{
2104-  Py_CLEAR (get_posix_state (module )-> billion );
2105-  Py_CLEAR (get_posix_state (module )-> DirEntryType );
2106-  Py_CLEAR (get_posix_state (module )-> ScandirIteratorType );
2104+  _posixstate  * state  =  get_posix_state (module );
2105+  Py_CLEAR (state -> billion );
2106+  Py_CLEAR (state -> DirEntryType );
2107+  Py_CLEAR (state -> ScandirIteratorType );
21072108#if  defined(HAVE_SCHED_SETPARAM ) ||  defined(HAVE_SCHED_SETSCHEDULER ) ||  defined(POSIX_SPAWN_SETSCHEDULER ) ||  defined(POSIX_SPAWN_SETSCHEDPARAM )
2108-  Py_CLEAR (get_posix_state ( module ) -> SchedParamType );
2109+  Py_CLEAR (state -> SchedParamType );
21092110#endif 
2110-  Py_CLEAR (get_posix_state ( module ) -> StatResultType );
2111-  Py_CLEAR (get_posix_state ( module ) -> StatVFSResultType );
2112-  Py_CLEAR (get_posix_state ( module ) -> TerminalSizeType );
2113-  Py_CLEAR (get_posix_state ( module ) -> TimesResultType );
2114-  Py_CLEAR (get_posix_state ( module ) -> UnameResultType );
2111+  Py_CLEAR (state -> StatResultType );
2112+  Py_CLEAR (state -> StatVFSResultType );
2113+  Py_CLEAR (state -> TerminalSizeType );
2114+  Py_CLEAR (state -> TimesResultType );
2115+  Py_CLEAR (state -> UnameResultType );
21152116#if  defined(HAVE_WAITID ) &&  !defined(__APPLE__ )
2116-  Py_CLEAR (get_posix_state ( module ) -> WaitidResultType );
2117+  Py_CLEAR (state -> WaitidResultType );
21172118#endif 
21182119#if  defined(HAVE_WAIT3 ) ||  defined(HAVE_WAIT4 )
2119-  Py_CLEAR (get_posix_state ( module ) -> struct_rusage );
2120+  Py_CLEAR (state -> struct_rusage );
21202121#endif 
2121-  Py_CLEAR (get_posix_state ( module ) -> st_mode );
2122+  Py_CLEAR (state -> st_mode );
21222123 return  0 ;
21232124}
21242125
21252126static  int 
21262127_posix_traverse (PyObject  * module , visitproc  visit , void  * arg )
21272128{
2128-  Py_VISIT (get_posix_state (module )-> billion );
2129-  Py_VISIT (get_posix_state (module )-> DirEntryType );
2130-  Py_VISIT (get_posix_state (module )-> ScandirIteratorType );
2129+  _posixstate  * state  =  get_posix_state (module );
2130+  Py_VISIT (state -> billion );
2131+  Py_VISIT (state -> DirEntryType );
2132+  Py_VISIT (state -> ScandirIteratorType );
21312133#if  defined(HAVE_SCHED_SETPARAM ) ||  defined(HAVE_SCHED_SETSCHEDULER ) ||  defined(POSIX_SPAWN_SETSCHEDULER ) ||  defined(POSIX_SPAWN_SETSCHEDPARAM )
2132-  Py_VISIT (get_posix_state ( module ) -> SchedParamType );
2134+  Py_VISIT (state -> SchedParamType );
21332135#endif 
2134-  Py_VISIT (get_posix_state ( module ) -> StatResultType );
2135-  Py_VISIT (get_posix_state ( module ) -> StatVFSResultType );
2136-  Py_VISIT (get_posix_state ( module ) -> TerminalSizeType );
2137-  Py_VISIT (get_posix_state ( module ) -> TimesResultType );
2138-  Py_VISIT (get_posix_state ( module ) -> UnameResultType );
2136+  Py_VISIT (state -> StatResultType );
2137+  Py_VISIT (state -> StatVFSResultType );
2138+  Py_VISIT (state -> TerminalSizeType );
2139+  Py_VISIT (state -> TimesResultType );
2140+  Py_VISIT (state -> UnameResultType );
21392141#if  defined(HAVE_WAITID ) &&  !defined(__APPLE__ )
2140-  Py_VISIT (get_posix_state ( module ) -> WaitidResultType );
2142+  Py_VISIT (state -> WaitidResultType );
21412143#endif 
21422144#if  defined(HAVE_WAIT3 ) ||  defined(HAVE_WAIT4 )
2143-  Py_VISIT (get_posix_state ( module ) -> struct_rusage );
2145+  Py_VISIT (state -> struct_rusage );
21442146#endif 
2145-  Py_VISIT (get_posix_state ( module ) -> st_mode );
2147+  Py_VISIT (state -> st_mode );
21462148 return  0 ;
21472149}
21482150
@@ -12777,8 +12779,7 @@ os_DirEntry_is_symlink_impl(DirEntry *self, PyTypeObject *defining_class)
1277712779}
1277812780
1277912781static  PyObject  * 
12780- DirEntry_fetch_stat (PyTypeObject  * defining_class , DirEntry  * self ,
12781-  int  follow_symlinks )
12782+ DirEntry_fetch_stat (PyObject  * module , DirEntry  * self , int  follow_symlinks )
1278212783{
1278312784 int  result ;
1278412785 STRUCT_STAT  st ;
@@ -12814,18 +12815,18 @@ DirEntry_fetch_stat(PyTypeObject *defining_class, DirEntry *self,
1281412815 if  (result  !=  0 )
1281512816 return  path_object_error (self -> path );
1281612817
12817-  return  _pystat_fromstructstat (PyType_GetModule ( defining_class ) , & st );
12818+  return  _pystat_fromstructstat (module , & st );
1281812819}
1281912820
1282012821static  PyObject  * 
1282112822DirEntry_get_lstat (PyTypeObject  * defining_class , DirEntry  * self )
1282212823{
1282312824 if  (!self -> lstat ) {
12825+  PyObject  * module  =  PyType_GetModule (defining_class );
1282412826#ifdef  MS_WINDOWS 
12825-  self -> lstat  =  _pystat_fromstructstat (PyType_GetModule (defining_class ),
12826-  & self -> win32_lstat );
12827+  self -> lstat  =  _pystat_fromstructstat (module , & self -> win32_lstat );
1282712828#else  /* POSIX */ 
12828-  self -> lstat  =  DirEntry_fetch_stat (defining_class , self , 0 );
12829+  self -> lstat  =  DirEntry_fetch_stat (module , self , 0 );
1282912830#endif 
1283012831 }
1283112832 Py_XINCREF (self -> lstat );
@@ -12857,7 +12858,8 @@ os_DirEntry_stat_impl(DirEntry *self, PyTypeObject *defining_class,
1285712858 return  NULL ;
1285812859 }
1285912860 if  (result ) {
12860-  self -> stat  =  DirEntry_fetch_stat (defining_class , self , 1 );
12861+  PyObject  * module  =  PyType_GetModule (defining_class );
12862+  self -> stat  =  DirEntry_fetch_stat (module , self , 1 );
1286112863 }
1286212864 else  {
1286312865 self -> stat  =  DirEntry_get_lstat (defining_class , self );
@@ -12906,7 +12908,8 @@ DirEntry_test_mode(PyTypeObject *defining_class, DirEntry *self,
1290612908 }
1290712909 goto error ;
1290812910 }
12909-  st_mode  =  PyObject_GetAttr (stat , get_posix_state (PyType_GetModule (defining_class ))-> st_mode );
12911+  _posixstate *  state  =  get_posix_state (PyType_GetModule (defining_class ));
12912+  st_mode  =  PyObject_GetAttr (stat , state -> st_mode );
1291012913 if  (!st_mode )
1291112914 goto error ;
1291212915
0 commit comments