[Python-checkins] cpython: cleanup signalmodule.c: use PyModule_AddIntMacro()

victor.stinner python-checkins at python.org
Mon May 2 16:17:35 CEST 2011


http://hg.python.org/cpython/rev/edee31e24bda
changeset:   69783:edee31e24bda
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon May 02 16:15:43 2011 +0200
summary:
  cleanup signalmodule.c: use PyModule_AddIntMacro()

files:
  Modules/signalmodule.c |  20 ++++++--------------
  1 files changed, 6 insertions(+), 14 deletions(-)


diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -720,24 +720,16 @@
     Py_DECREF(x);
 
 #ifdef SIG_BLOCK
-    x = PyLong_FromLong(SIG_BLOCK);
-    if (!x || PyDict_SetItemString(d, "SIG_BLOCK", x) < 0)
-        goto finally;
-    Py_DECREF(x);
+    if (PyModule_AddIntMacro(m, SIG_BLOCK))
+         goto finally;
 #endif
-
 #ifdef SIG_UNBLOCK
-    x = PyLong_FromLong(SIG_UNBLOCK);
-    if (!x || PyDict_SetItemString(d, "SIG_UNBLOCK", x) < 0)
-        goto finally;
-    Py_DECREF(x);
+    if (PyModule_AddIntMacro(m, SIG_UNBLOCK))
+         goto finally;
 #endif
-
 #ifdef SIG_SETMASK
-    x = PyLong_FromLong(SIG_SETMASK);
-    if (!x || PyDict_SetItemString(d, "SIG_SETMASK", x) < 0)
-        goto finally;
-    Py_DECREF(x);
+    if (PyModule_AddIntMacro(m, SIG_SETMASK))
+         goto finally;
 #endif
 
     x = IntHandler = PyDict_GetItemString(d, "default_int_handler");

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list