diff Include/code.h @ 42333:6620a510e9a9 legacy-trunk

PEP 3123: Provide forward compatibility with Python 3.0, while keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 21 Jul 2007 06:55:02 +0000
parents b8fbd322760a
children 26384b8180c7
line wrap: on
line diff
--- a/Include/code.h	Thu Jul 19 23:57:38 2007 +0000
+++ b/Include/code.h	Sat Jul 21 06:55:02 2007 +0000
@@ -60,7 +60,7 @@
 
 PyAPI_DATA(PyTypeObject) PyCode_Type;
 
-#define PyCode_Check(op) ((op)->ob_type == &PyCode_Type)
+#define PyCode_Check(op) (Py_Type(op) == &PyCode_Type)
 #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars))
 
 /* Public interface */
@@ -72,7 +72,7 @@
 
 /* for internal use only */
 #define _PyCode_GETCODEPTR(co, pp) \
-	((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \
+	((*Py_Type((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \
 	 ((co)->co_code, 0, (void **)(pp)))
 
 typedef struct _addr_pair {