@@ -16793,57 +16793,49 @@ posixmodule_exec(PyObject *m)
16793
16793
if (setup_confname_tables (m ))
16794
16794
return -1 ;
16795
16795
16796
- PyModule_AddObject (m , "error" , Py_NewRef (PyExc_OSError ));
16796
+ if (PyModule_AddObjectRef (m , "error" , PyExc_OSError ) < 0 ) {
16797
+ return -1 ;
16798
+ }
16797
16799
16798
16800
#if defined(HAVE_WAITID ) && !defined(__APPLE__ )
16799
16801
waitid_result_desc .name = MODNAME ".waitid_result" ;
16800
- PyObject * WaitidResultType = (PyObject * )PyStructSequence_NewType (& waitid_result_desc );
16801
- if (WaitidResultType == NULL ) {
16802
+ state -> WaitidResultType = (PyObject * )PyStructSequence_NewType (& waitid_result_desc );
16803
+ if (PyModule_AddObjectRef ( m , "waitid_result" , state -> WaitidResultType ) < 0 ) {
16802
16804
return -1 ;
16803
16805
}
16804
- PyModule_AddObject (m , "waitid_result" , Py_NewRef (WaitidResultType ));
16805
- state -> WaitidResultType = WaitidResultType ;
16806
16806
#endif
16807
16807
16808
16808
stat_result_desc .name = "os.stat_result" ; /* see issue #19209 */
16809
16809
stat_result_desc .fields [7 ].name = PyStructSequence_UnnamedField ;
16810
16810
stat_result_desc .fields [8 ].name = PyStructSequence_UnnamedField ;
16811
16811
stat_result_desc .fields [9 ].name = PyStructSequence_UnnamedField ;
16812
- PyObject * StatResultType = (PyObject * )PyStructSequence_NewType (& stat_result_desc );
16813
- if (StatResultType == NULL ) {
16812
+ state -> StatResultType = (PyObject * )PyStructSequence_NewType (& stat_result_desc );
16813
+ if (PyModule_AddObjectRef ( m , "stat_result" , state -> StatResultType ) < 0 ) {
16814
16814
return -1 ;
16815
16815
}
16816
- PyModule_AddObject (m , "stat_result" , Py_NewRef (StatResultType ));
16817
- state -> StatResultType = StatResultType ;
16818
- state -> statresult_new_orig = ((PyTypeObject * )StatResultType )-> tp_new ;
16819
- ((PyTypeObject * )StatResultType )-> tp_new = statresult_new ;
16816
+ state -> statresult_new_orig = ((PyTypeObject * )state -> StatResultType )-> tp_new ;
16817
+ ((PyTypeObject * )state -> StatResultType )-> tp_new = statresult_new ;
16820
16818
16821
16819
statvfs_result_desc .name = "os.statvfs_result" ; /* see issue #19209 */
16822
- PyObject * StatVFSResultType = (PyObject * )PyStructSequence_NewType (& statvfs_result_desc );
16823
- if (StatVFSResultType == NULL ) {
16820
+ state -> StatVFSResultType = (PyObject * )PyStructSequence_NewType (& statvfs_result_desc );
16821
+ if (PyModule_AddObjectRef ( m , "statvfs_result" , state -> StatVFSResultType ) < 0 ) {
16824
16822
return -1 ;
16825
16823
}
16826
- PyModule_AddObject (m , "statvfs_result" , Py_NewRef (StatVFSResultType ));
16827
- state -> StatVFSResultType = StatVFSResultType ;
16828
16824
16829
16825
#if defined(HAVE_SCHED_SETPARAM ) || defined(HAVE_SCHED_SETSCHEDULER ) || defined(POSIX_SPAWN_SETSCHEDULER ) || defined(POSIX_SPAWN_SETSCHEDPARAM )
16830
16826
sched_param_desc .name = MODNAME ".sched_param" ;
16831
- PyObject * SchedParamType = (PyObject * )PyStructSequence_NewType (& sched_param_desc );
16832
- if (SchedParamType == NULL ) {
16827
+ state -> SchedParamType = (PyObject * )PyStructSequence_NewType (& sched_param_desc );
16828
+ if (PyModule_AddObjectRef ( m , "sched_param" , state -> SchedParamType ) < 0 ) {
16833
16829
return -1 ;
16834
16830
}
16835
- PyModule_AddObject (m , "sched_param" , Py_NewRef (SchedParamType ));
16836
- state -> SchedParamType = SchedParamType ;
16837
- ((PyTypeObject * )SchedParamType )-> tp_new = os_sched_param ;
16831
+ ((PyTypeObject * )state -> SchedParamType )-> tp_new = os_sched_param ;
16838
16832
#endif
16839
16833
16840
16834
/* initialize TerminalSize_info */
16841
- PyObject * TerminalSizeType = (PyObject * )PyStructSequence_NewType (& TerminalSize_desc );
16842
- if (TerminalSizeType == NULL ) {
16835
+ state -> TerminalSizeType = (PyObject * )PyStructSequence_NewType (& TerminalSize_desc );
16836
+ if (PyModule_AddObjectRef ( m , "terminal_size" , state -> TerminalSizeType ) < 0 ) {
16843
16837
return -1 ;
16844
16838
}
16845
- PyModule_AddObject (m , "terminal_size" , Py_NewRef (TerminalSizeType ));
16846
- state -> TerminalSizeType = TerminalSizeType ;
16847
16839
16848
16840
/* initialize scandir types */
16849
16841
PyObject * ScandirIteratorType = PyType_FromModuleAndSpec (m , & ScandirIteratorType_spec , NULL );
@@ -16852,28 +16844,21 @@ posixmodule_exec(PyObject *m)
16852
16844
}
16853
16845
state -> ScandirIteratorType = ScandirIteratorType ;
16854
16846
16855
- PyObject * DirEntryType = PyType_FromModuleAndSpec (m , & DirEntryType_spec , NULL );
16856
- if (DirEntryType == NULL ) {
16847
+ state -> DirEntryType = PyType_FromModuleAndSpec (m , & DirEntryType_spec , NULL );
16848
+ if (PyModule_AddObjectRef ( m , "DirEntry" , state -> DirEntryType ) < 0 ) {
16857
16849
return -1 ;
16858
16850
}
16859
- PyModule_AddObject (m , "DirEntry" , Py_NewRef (DirEntryType ));
16860
- state -> DirEntryType = DirEntryType ;
16861
16851
16862
16852
times_result_desc .name = MODNAME ".times_result" ;
16863
- PyObject * TimesResultType = (PyObject * )PyStructSequence_NewType (& times_result_desc );
16864
- if (TimesResultType == NULL ) {
16853
+ state -> TimesResultType = (PyObject * )PyStructSequence_NewType (& times_result_desc );
16854
+ if (PyModule_AddObjectRef ( m , "times_result" , state -> TimesResultType ) < 0 ) {
16865
16855
return -1 ;
16866
16856
}
16867
- PyModule_AddObject (m , "times_result" , Py_NewRef (TimesResultType ));
16868
- state -> TimesResultType = TimesResultType ;
16869
16857
16870
- PyTypeObject * UnameResultType = PyStructSequence_NewType (& uname_result_desc );
16871
- if (UnameResultType == NULL ) {
16858
+ state -> UnameResultType = ( PyObject * ) PyStructSequence_NewType (& uname_result_desc );
16859
+ if (PyModule_AddObjectRef ( m , "uname_result" , state -> UnameResultType ) < 0 ) {
16872
16860
return -1 ;
16873
16861
}
16874
- ;
16875
- PyModule_AddObject (m , "uname_result" , Py_NewRef (UnameResultType ));
16876
- state -> UnameResultType = (PyObject * )UnameResultType ;
16877
16862
16878
16863
if ((state -> billion = PyLong_FromLong (1000000000 )) == NULL )
16879
16864
return -1 ;
0 commit comments