[Python-checkins] python/dist/src/Objects typeobject.c,2.258,2.259

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Fri Jun 11 10:41:21 EDT 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1819/Objects

Modified Files:
	typeobject.c 
Log Message:
Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.

Bugfix candidate, will backport.



Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.258
retrieving revision 2.259
diff -C2 -d -r2.258 -r2.259
*** typeobject.c	25 Mar 2004 16:37:03 -0000	2.258
--- typeobject.c	11 Jun 2004 14:41:17 -0000	2.259
***************
*** 88,91 ****
--- 88,95 ----
  	if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
  		mod = PyDict_GetItemString(type->tp_dict, "__module__");
+ 		if (!mod) { 
+ 			PyErr_Format(PyExc_AttributeError, "__module__");
+ 			return 0;
+ 		}
  		Py_XINCREF(mod);
  		return mod;




More information about the Python-checkins mailing list