Merged revisions 64223-64224 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64223 | georg.brandl | 2008-06-13 01:56:50 -0500 (Fri, 13 Jun 2008) | 2 lines

  #3095: don't leak values from Py_BuildValue.
........
  r64224 | georg.brandl | 2008-06-13 02:08:48 -0500 (Fri, 13 Jun 2008) | 2 lines

  Typo.
........
This commit is contained in:
Benjamin Peterson 2008-06-13 15:36:43 +00:00
parent f38e0d0c8c
commit af065c34bc
1 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Extension module used by mutliprocessing package
* Extension module used by multiprocessing package
*
* multiprocessing.c
*
@ -228,7 +228,7 @@ static struct PyModuleDef multiprocessing_module = {
PyMODINIT_FUNC
PyInit__multiprocessing(void)
{
PyObject *module, *temp;
PyObject *module, *temp, *value;
/* Initialize module */
module = PyModule_Create(&multiprocessing_module);
@ -297,11 +297,13 @@ PyInit__multiprocessing(void)
temp = PyDict_New();
if (!temp)
return NULL;
if (PyModule_AddObject(module, "flags", temp) < 0)
return NULL;
#define ADD_FLAG(name) \
if (PyDict_SetItemString(temp, #name, Py_BuildValue("i", name)) < 0) return NULL
#define ADD_FLAG(name) \
value = Py_BuildValue("i", name); \
if (value == NULL) { Py_DECREF(temp); return NULL; } \
if (PyDict_SetItemString(temp, #name, value) < 0) { \
Py_DECREF(temp); Py_DECREF(value); return NULL; } \
Py_DECREF(value)
#ifdef HAVE_SEM_OPEN
ADD_FLAG(HAVE_SEM_OPEN);
@ -318,5 +320,9 @@ PyInit__multiprocessing(void)
#ifdef HAVE_BROKEN_SEM_UNLINK
ADD_FLAG(HAVE_BROKEN_SEM_UNLINK);
#endif
if (PyModule_AddObject(module, "flags", temp) < 0)
return NULL;
return module;
}