[Python-checkins] CVS: python/dist/src/Modules structmodule.c,2.51,2.52
Fred L. Drake
fdrake@users.sourceforge.net
Wed, 13 Feb 2002 23:11:25 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv21476/Modules
Modified Files:
structmodule.c
Log Message:
Use PyModule_AddObject() instead of accessing the module dict directly.
Index: structmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v
retrieving revision 2.51
retrieving revision 2.52
diff -C2 -d -r2.51 -r2.52
*** structmodule.c 24 Oct 2001 20:37:10 -0000 2.51
--- structmodule.c 14 Feb 2002 07:11:23 -0000 2.52
***************
*** 1503,1507 ****
initstruct(void)
{
! PyObject *m, *d;
/* Create the module and add the functions */
--- 1503,1507 ----
initstruct(void)
{
! PyObject *m;
/* Create the module and add the functions */
***************
*** 1510,1517 ****
/* Add some symbolic constants to the module */
! d = PyModule_GetDict(m);
! StructError = PyErr_NewException("struct.error", NULL, NULL);
! if (StructError == NULL)
! return;
! PyDict_SetItemString(d, "error", StructError);
}
--- 1510,1519 ----
/* Add some symbolic constants to the module */
! if (StructError == NULL) {
! StructError = PyErr_NewException("struct.error", NULL, NULL);
! if (StructError == NULL)
! return;
! }
! Py_INCREF(StructError);
! PyModule_AddObject(d, "error", StructError);
}