[Python-checkins] python/dist/src/Objects typeobject.c, 2.241.6.9, 2.241.6.10

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Fri Jun 11 11:09:44 EDT 2004


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

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


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.241.6.9
retrieving revision 2.241.6.10
diff -C2 -d -r2.241.6.9 -r2.241.6.10
*** typeobject.c	11 May 2004 16:35:05 -0000	2.241.6.9
--- typeobject.c	11 Jun 2004 15:09:41 -0000	2.241.6.10
***************
*** 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