diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2007-07-21 06:55:02 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2007-07-21 06:55:02 +0000 |
commit | 6819210b9e4e5719a6f7f9c1725f8fa70a8936f6 (patch) | |
tree | 456e2e6b3d9d71e966f3b0e419ecfe44ce3c1fdd /Objects/funcobject.c | |
parent | b1994b4a5d0139a010eb0af1d6615a3df92fe786 (diff) | |
download | cpython-git-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.tar.gz |
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r-- | Objects/funcobject.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 190765a547..913c8c509b 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -544,8 +544,7 @@ func_descr_get(PyObject *func, PyObject *obj, PyObject *type) } PyTypeObject PyFunction_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "function", sizeof(PyFunctionObject), 0, @@ -615,7 +614,7 @@ cm_dealloc(classmethod *cm) { _PyObject_GC_UNTRACK((PyObject *)cm); Py_XDECREF(cm->cm_callable); - cm->ob_type->tp_free((PyObject *)cm); + Py_Type(cm)->tp_free((PyObject *)cm); } static int @@ -644,9 +643,9 @@ cm_descr_get(PyObject *self, PyObject *obj, PyObject *type) return NULL; } if (type == NULL) - type = (PyObject *)(obj->ob_type); + type = (PyObject *)(Py_Type(obj)); return PyMethod_New(cm->cm_callable, - type, (PyObject *)(type->ob_type)); + type, (PyObject *)(Py_Type(type))); } static int @@ -692,8 +691,7 @@ Class methods are different than C++ or Java static methods.\n\ If you want those, see the staticmethod builtin."); PyTypeObject PyClassMethod_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "classmethod", sizeof(classmethod), 0, @@ -773,7 +771,7 @@ sm_dealloc(staticmethod *sm) { _PyObject_GC_UNTRACK((PyObject *)sm); Py_XDECREF(sm->sm_callable); - sm->ob_type->tp_free((PyObject *)sm); + Py_Type(sm)->tp_free((PyObject *)sm); } static int @@ -840,8 +838,7 @@ Static methods in Python are similar to those found in Java or C++.\n\ For a more advanced concept, see the classmethod builtin."); PyTypeObject PyStaticMethod_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "staticmethod", sizeof(staticmethod), 0, |