[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.124,2.125
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 13 Dec 2001 20:19:24 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv28799
Modified Files:
typeobject.c
Log Message:
(Merge into trunk.)
Fix for SF bug #492345. (I could've sworn I checked this in, but
apparently I didn't!)
This code:
class Classic:
pass
class New(Classic):
__metaclass__ = type
attempts to create a new-style class with only classic bases -- but it
doesn't work right. Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.124
retrieving revision 2.125
diff -C2 -d -r2.124 -r2.125
*** typeobject.c 2001/12/06 02:35:58 2.124
--- typeobject.c 2001/12/14 04:19:22 2.125
***************
*** 758,762 ****
}
}
! assert(base != NULL);
return base;
}
--- 758,764 ----
}
}
! if (base == NULL)
! PyErr_SetString(PyExc_TypeError,
! "a new-style class can't have only classic bases");
return base;
}