[Python-checkins] CVS: python/dist/src/Objects object.c,2.144,2.145
Guido van Rossum
gvanrossum@users.sourceforge.net
Mon, 10 Sep 2001 11:27:45 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv19877
Modified Files:
object.c
Log Message:
PyObject_Dir():
- use PyModule_Check() instead of PyObject_TypeCheck(), now we can.
- don't assert that the __dict__ gotten out of a module is always
a dictionary; check its type, and raise an exception if it's not.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.144
retrieving revision 2.145
diff -C2 -d -r2.144 -r2.145
*** object.c 2001/09/04 22:08:56 2.144
--- object.c 2001/09/10 18:27:43 2.145
***************
*** 1425,1433 ****
/* Elif this is some form of module, we only want its dict. */
! else if (PyObject_TypeCheck(arg, &PyModule_Type)) {
masterdict = PyObject_GetAttrString(arg, "__dict__");
if (masterdict == NULL)
goto error;
! assert(PyDict_Check(masterdict));
}
--- 1425,1437 ----
/* Elif this is some form of module, we only want its dict. */
! else if (PyModule_Check(arg)) {
masterdict = PyObject_GetAttrString(arg, "__dict__");
if (masterdict == NULL)
goto error;
! if (!PyDict_Check(masterdict)) {
! PyErr_SetString(PyExc_TypeError,
! "module.__dict__ is not a dictionary");
! goto error;
! }
}