cpython: c72063032a7a (original) (raw)

Mercurial > cpython

changeset 73062:c72063032a7a

Merge issue 1294232 patch from 3.2 [#1294232]

Nick Coghlan ncoghlan@gmail.com
date Sun, 23 Oct 2011 22:36:42 +1000
parents 96d5f53a414a(current diff)c2a89b509be4(diff)
children 1959b2332c6a
files Include/object.h Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Python/bltinmodule.c
diffstat 5 files changed, 244 insertions(+), 23 deletions(-)[+] [-] Include/object.h 1 Lib/test/test_descr.py 168 Misc/NEWS 4 Objects/typeobject.c 61 Python/bltinmodule.c 33

line wrap: on

line diff

--- a/Include/object.h +++ b/Include/object.h @@ -449,6 +449,7 @@ PyAPI_FUNC(PyObject *) PyType_GenericNew #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **); +PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); #endif PyAPI_FUNC(unsigned int) PyType_ClearCache(void); PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);

--- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -625,6 +625,174 @@ class ClassPropertiesAndMethods(unittest # The most derived metaclass of D is A rather than type. class D(B, C): pass

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

def test_module_subclasses(self): # Testing Python subclass of module...

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ What's New in Python 3.3 Alpha 1? Core and Builtins ----------------- +- Issue #1294232: In a few cases involving metaclass inheritance, the

--- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1915,6 +1915,42 @@ PyType_GetFlags(PyTypeObject type) return type->tp_flags; } +/ Determine the most derived metatype. */ +PyTypeObject * +_PyType_CalculateMetaclass(PyTypeObject *metatype, PyObject *bases) +{

+

+

+} + static PyObject * type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) { @@ -1958,28 +1994,12 @@ type_new(PyTypeObject *metatype, PyObjec &PyDict_Type, &dict)) return NULL;

@@ -1987,6 +2007,7 @@ type_new(PyTypeObject metatype, PyObjec } / Adjust for empty tuple bases */

--- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -38,9 +38,10 @@ int Py_HasFileSystemDefaultEncoding = 0; static PyObject * builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds) {