@@ -1346,21 +1346,19 @@ PyInit__signal(void)
1346
1346
initialized = 1 ;
1347
1347
#endif
1348
1348
1349
- /* Add some symbolic constants to the module */
1350
1349
d = PyModule_GetDict (m );
1351
1350
1352
1351
x = DefaultHandler = PyLong_FromVoidPtr ((void * )SIG_DFL );
1353
- if (! x || PyDict_SetItemString ( d , "SIG_DFL" , x ) < 0 )
1354
- goto finally ;
1352
+ if (PyModule_AddObject ( m , "SIG_DFL" , x ))
1353
+ goto finally ;
1355
1354
1356
1355
x = IgnoreHandler = PyLong_FromVoidPtr ((void * )SIG_IGN );
1357
- if (! x || PyDict_SetItemString ( d , "SIG_IGN" , x ) < 0 )
1358
- goto finally ;
1356
+ if (PyModule_AddObject ( m , "SIG_IGN" , x ))
1357
+ goto finally ;
1359
1358
1360
1359
x = PyLong_FromLong ((long )NSIG );
1361
- if (!x || PyDict_SetItemString (d , "NSIG" , x ) < 0 )
1362
- goto finally ;
1363
- Py_DECREF (x );
1360
+ if (PyModule_AddObject (m , "NSIG" , x ))
1361
+ goto finally ;
1364
1362
1365
1363
#ifdef SIG_BLOCK
1366
1364
if (PyModule_AddIntMacro (m , SIG_BLOCK ))
@@ -1569,8 +1567,8 @@ PyInit__signal(void)
1569
1567
#if defined (HAVE_SETITIMER ) || defined (HAVE_GETITIMER )
1570
1568
ItimerError = PyErr_NewException ("signal.ItimerError" ,
1571
1569
PyExc_OSError , NULL );
1572
- if (ItimerError != NULL )
1573
- PyDict_SetItemString ( d , "ItimerError" , ItimerError ) ;
1570
+ if (PyModule_AddObject ( m , " ItimerError" , ItimerError ) )
1571
+ goto finally ;
1574
1572
#endif
1575
1573
1576
1574
#ifdef CTRL_C_EVENT
0 commit comments