[Python-checkins] CVS: python/dist/src/Python ceval.c,2.241.2.6,2.241.2.7
Guido van Rossum
gvanrossum@users.sourceforge.net
Sun, 08 Jul 2001 04:51:57 -0700
- Previous message: [Python-checkins] CVS: python/dist/src/Lib/test/output test___all__,1.1,NONE test___future__,1.1,NONE test_al,1.1,NONE test_array,1.1,NONE test_audioop,1.1,NONE test_binhex,1.1,NONE test_bisect,1.1,NONE test_bsddb,1.1,NONE test_bufio,1.1,NONE test_capi,1.1,NONE test_cd,1.1,NONE test_cl,1.1,NONE test_cmath,1.1,NONE test_complex,1.1,NONE test_contains,1.1,NONE test_crypt,1.2,NONE test_dbm,1.1,NONE test_dl,1.1,NONE test_dumbdbm,1.1,NONE test_errno,1.1,NONE test_fcntl,1.1,NONE test_file,1.1,NONE test_fnmatch,1.1,NONE test_fork1,1.1,NONE test_format,1.1,NONE test_funcattrs,1.1,NONE test_gc,1.2,NONE test_gdbm,1.1,NONE test_getopt,1.2,NONE test_gl,1.1,NONE test_grp,1.1,NONE test_gzip,1.1,NONE test_hash,1.1,NONE test_imageop,1.1,NONE test_imgfile,1.1,NONE test_import,1.1,NONE test_inspect,1.1,NONE test_iter,1.2,NONE test_largefile,1.1,NONE test_locale,1.1,NONE test_rfc822,1.1,NONE test_select,1.2,NONE test_sre,1.12,NONE test_strftime,1.2,NONE test_struct,1.2,NONE test_sunaudiodev,1.1,NONE test_sundry,1.1,NONE test_symtable,1.1,NONE test_time,1.1,NONE test_timing,1.1,NONE test_traceback,1.1,NONE test_unpack,1.1,NONE test_urllib,1.1,NONE test_userdict,1.1,NONE test_userlist,1.1,NONE test_userstring,1.3,NONE test_wave,1.1,NONE test_weakref,1.3,NONE test_xmllib,1.1,NONE test_zipfile,1.1,NONE
- Next message: [Python-checkins] CVS: python/dist/src/Modules _sre.c,2.60,2.61
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv3727
Modified Files:
Tag: descr-branch
ceval.c
Log Message:
Add a feature: if a global variable __metaclass__ exists, use that as
the default metaclass, rather than &PyClass_Type. This makes it
possible to write modules where all classes are new-style classes
without having to add "__metaclass__ = type" (or a base class
'object') to each class. This serves as a future statement for the
default metaclass.
Classes derived from classic classes defined in other modules are
exempt; the default metaclass is only used when there are no base
classes, otherwise the metaclass of the first base class is used.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.241.2.6
retrieving revision 2.241.2.7
diff -C2 -r2.241.2.6 -r2.241.2.7
*** ceval.c 2001/07/08 04:30:29 2.241.2.6
--- ceval.c 2001/07/08 11:51:54 2.241.2.7
***************
*** 3605,3610 ****
metaclass = (PyObject *)
PyTuple_GET_ITEM(bases, 0)->ob_type;
! else
! metaclass = (PyObject *) &PyClass_Type;
}
return PyObject_CallFunction(metaclass, "OOO", name, bases, methods);
--- 3605,3616 ----
metaclass = (PyObject *)
PyTuple_GET_ITEM(bases, 0)->ob_type;
! else {
! PyObject *g = PyEval_GetGlobals();
! if (g != NULL && PyDict_Check(g))
! metaclass = PyDict_GetItemString(
! g, "__metaclass__");
! if (metaclass == NULL)
! metaclass = (PyObject *) &PyClass_Type;
! }
}
return PyObject_CallFunction(metaclass, "OOO", name, bases, methods);
- Previous message: [Python-checkins] CVS: python/dist/src/Lib/test/output test___all__,1.1,NONE test___future__,1.1,NONE test_al,1.1,NONE test_array,1.1,NONE test_audioop,1.1,NONE test_binhex,1.1,NONE test_bisect,1.1,NONE test_bsddb,1.1,NONE test_bufio,1.1,NONE test_capi,1.1,NONE test_cd,1.1,NONE test_cl,1.1,NONE test_cmath,1.1,NONE test_complex,1.1,NONE test_contains,1.1,NONE test_crypt,1.2,NONE test_dbm,1.1,NONE test_dl,1.1,NONE test_dumbdbm,1.1,NONE test_errno,1.1,NONE test_fcntl,1.1,NONE test_file,1.1,NONE test_fnmatch,1.1,NONE test_fork1,1.1,NONE test_format,1.1,NONE test_funcattrs,1.1,NONE test_gc,1.2,NONE test_gdbm,1.1,NONE test_getopt,1.2,NONE test_gl,1.1,NONE test_grp,1.1,NONE test_gzip,1.1,NONE test_hash,1.1,NONE test_imageop,1.1,NONE test_imgfile,1.1,NONE test_import,1.1,NONE test_inspect,1.1,NONE test_iter,1.2,NONE test_largefile,1.1,NONE test_locale,1.1,NONE test_rfc822,1.1,NONE test_select,1.2,NONE test_sre,1.12,NONE test_strftime,1.2,NONE test_struct,1.2,NONE test_sunaudiodev,1.1,NONE test_sundry,1.1,NONE test_symtable,1.1,NONE test_time,1.1,NONE test_timing,1.1,NONE test_traceback,1.1,NONE test_unpack,1.1,NONE test_urllib,1.1,NONE test_userdict,1.1,NONE test_userlist,1.1,NONE test_userstring,1.3,NONE test_wave,1.1,NONE test_weakref,1.3,NONE test_xmllib,1.1,NONE test_zipfile,1.1,NONE
- Next message: [Python-checkins] CVS: python/dist/src/Modules _sre.c,2.60,2.61
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]