[Python-checkins] python/dist/src/Python modsupport.c,2.55,2.55.2.1

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Mon, 17 Jun 2002 10:16:14 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv26263/Python

Modified Files:
      Tag: release21-maint
	modsupport.c 
Log Message:
PyModule_AddObject():  Added missing exceptions.
Closes SF bug #523473.


Index: modsupport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v
retrieving revision 2.55
retrieving revision 2.55.2.1
diff -C2 -d -r2.55 -r2.55.2.1
*** modsupport.c	12 Mar 2001 21:03:26 -0000	2.55
--- modsupport.c	17 Jun 2002 17:16:11 -0000	2.55.2.1
***************
*** 468,480 ****
  {
  	PyObject *dict;
!         if (!PyModule_Check(m) || o == NULL)
!                 return -1;
  	dict = PyModule_GetDict(m);
! 	if (dict == NULL)
  		return -1;
!         if (PyDict_SetItemString(dict, name, o))
!                 return -1;
!         Py_DECREF(o);
!         return 0;
  }
  
--- 468,487 ----
  {
  	PyObject *dict;
! 	if (!PyModule_Check(m) || o == NULL) {
! 		PyErr_SetString(PyExc_TypeError,
! 			    "PyModule_AddObject() needs module as first arg");
! 		return -1;
! 	}
  	dict = PyModule_GetDict(m);
! 	if (dict == NULL) {
! 		/* Internal error -- modules must have a dict! */
! 		PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
! 			     PyModule_GetName(m));
  		return -1;
! 	}
! 	if (PyDict_SetItemString(dict, name, o))
! 		return -1;
! 	Py_DECREF(o);
! 	return 0;
  }