[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.64,2.16.8.65
Guido van Rossum
gvanrossum@users.sourceforge.net
Tue, 10 Jul 2001 09:28:06 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv11637
Modified Files:
Tag: descr-branch
typeobject.c
Log Message:
type_new(): only accept the special 1-argument form when the metatype
argument is &PyType_Type. When it isn't, we're being invoked by a
derived type's tp_new() slot, and we should always return a new
object.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.16.8.64
retrieving revision 2.16.8.65
diff -C2 -r2.16.8.64 -r2.16.8.65
*** typeobject.c 2001/07/08 04:30:29 2.16.8.64
--- typeobject.c 2001/07/10 16:28:04 2.16.8.65
***************
*** 449,453 ****
int i, nbases, nslots, slotoffset, dynamic;
! if (PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 &&
(kwds == NULL || (PyDict_Check(kwds) && PyDict_Size(kwds) == 0))) {
/* type(x) -> x.__class__ */
--- 449,454 ----
int i, nbases, nslots, slotoffset, dynamic;
! if (metatype == &PyType_Type &&
! PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 &&
(kwds == NULL || (PyDict_Check(kwds) && PyDict_Size(kwds) == 0))) {
/* type(x) -> x.__class__ */