[Python-3000-checkins] r56483 - in python/branches/py3k-struni: Include/Python.h Include/abstract.h Include/boolobject.h Include/bufferobject.h Include/bytesobject.h Include/cStringIO.h Include/cellobject.h Include/cobject.h Include/code.h Include/complexobject.h Include/datetime.h Include/descrobject.h Include/dictobject.h Include/floatobject.h Include/frameobject.h Include/funcobject.h Include/genobject.h Include/iterobject.h Include/listobject.h Include/longintrepr.h Include/longobject.h Include/methodobject.h Include/moduleobject.h Include/object.h Include/objimpl.h Include/py_curses.h Include/rangeobject.h Include/setobject.h Include/sliceobject.h Include/stringobject.h Include/symtable.h Include/traceback.h Include/tupleobject.h Include/unicodeobject.h Include/weakrefobject.h Misc/NEWS Modules/_bsddb.c Modules/_collectionsmodule.c Modules/_csv.c Modules/_ctypes/_ctypes.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/stgdict.c Modules/_curses_panel.c Modules/_cursesmodule.c Modules/_elementtree.c Modules/_fileio.c Modules/_functoolsmodule.c Modules/_hashopenssl.c Modules/_hotshot.c Modules/_lsprof.c Modules/_randommodule.c Modules/_sqlite/cache.c Modules/_sqlite/connection.c Modules/_sqlite/cursor.c Modules/_sqlite/prepare_protocol.c Modules/_sqlite/row.c Modules/_sqlite/statement.c Modules/_sre.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/_typesmodule.c Modules/_weakref.c Modules/arraymodule.c Modules/bz2module.c Modules/cStringIO.c Modules/cjkcodecs/multibytecodec.c Modules/datetimemodule.c Modules/dbmmodule.c Modules/dlmodule.c Modules/gcmodule.c Modules/gdbmmodule.c Modules/itertoolsmodule.c Modules/linuxaudiodev.c Modules/mathmodule.c Modules/mmapmodule.c Modules/operator.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/pyexpat.c Modules/selectmodule.c Modules/sha256module.c Modules/sha512module.c Modules/socketmodule.c Modules/sunaudiodev.c Modules/threadmodule.c Modules/unicodedata.c Modules/xxmodule.c Modules/xxsubtype.c Modules/zipimport.c Modules/zlibmodule.c Objects/boolobject.c Objects/bufferobject.c Objects/bytesobject.c Objects/cellobject.c Objects/classobject.c Objects/cobject.c Objects/codeobject.c Objects/complexobject.c Objects/descrobject.c Objects/dictobject.c Objects/enumobject.c Objects/exceptions.c Objects/floatobject.c Objects/frameobject.c Objects/funcobject.c Objects/genobject.c Objects/intobject.c Objects/iterobject.c Objects/listobject.c Objects/longobject.c Objects/methodobject.c Objects/moduleobject.c Objects/object.c Objects/obmalloc.c Objects/rangeobject.c Objects/setobject.c Objects/sliceobject.c Objects/stringobject.c Objects/structseq.c Objects/tupleobject.c Objects/typeobject.c Objects/unicodeobject.c Objects/weakrefobject.c PC/_msi.c PC/_winreg.c Python/ceval.c Python/import.c Python/marshal.c Python/symtable.c Python/traceback.c

martin.v.loewis python-3000-checkins at python.org
Sat Jul 21 19:22:24 CEST 2007


Author: martin.v.loewis
Date: Sat Jul 21 19:22:18 2007
New Revision: 56483

Modified:
   python/branches/py3k-struni/   (props changed)
   python/branches/py3k-struni/Include/Python.h
   python/branches/py3k-struni/Include/abstract.h
   python/branches/py3k-struni/Include/boolobject.h
   python/branches/py3k-struni/Include/bufferobject.h
   python/branches/py3k-struni/Include/bytesobject.h
   python/branches/py3k-struni/Include/cStringIO.h
   python/branches/py3k-struni/Include/cellobject.h
   python/branches/py3k-struni/Include/cobject.h
   python/branches/py3k-struni/Include/code.h
   python/branches/py3k-struni/Include/complexobject.h
   python/branches/py3k-struni/Include/datetime.h
   python/branches/py3k-struni/Include/descrobject.h
   python/branches/py3k-struni/Include/dictobject.h
   python/branches/py3k-struni/Include/floatobject.h
   python/branches/py3k-struni/Include/frameobject.h
   python/branches/py3k-struni/Include/funcobject.h
   python/branches/py3k-struni/Include/genobject.h
   python/branches/py3k-struni/Include/iterobject.h
   python/branches/py3k-struni/Include/listobject.h
   python/branches/py3k-struni/Include/longintrepr.h
   python/branches/py3k-struni/Include/longobject.h
   python/branches/py3k-struni/Include/methodobject.h
   python/branches/py3k-struni/Include/moduleobject.h
   python/branches/py3k-struni/Include/object.h
   python/branches/py3k-struni/Include/objimpl.h
   python/branches/py3k-struni/Include/py_curses.h
   python/branches/py3k-struni/Include/rangeobject.h
   python/branches/py3k-struni/Include/setobject.h
   python/branches/py3k-struni/Include/sliceobject.h
   python/branches/py3k-struni/Include/stringobject.h
   python/branches/py3k-struni/Include/symtable.h
   python/branches/py3k-struni/Include/traceback.h
   python/branches/py3k-struni/Include/tupleobject.h
   python/branches/py3k-struni/Include/unicodeobject.h
   python/branches/py3k-struni/Include/weakrefobject.h
   python/branches/py3k-struni/Misc/NEWS
   python/branches/py3k-struni/Modules/_bsddb.c
   python/branches/py3k-struni/Modules/_collectionsmodule.c
   python/branches/py3k-struni/Modules/_csv.c
   python/branches/py3k-struni/Modules/_ctypes/_ctypes.c
   python/branches/py3k-struni/Modules/_ctypes/callproc.c
   python/branches/py3k-struni/Modules/_ctypes/cfield.c
   python/branches/py3k-struni/Modules/_ctypes/stgdict.c
   python/branches/py3k-struni/Modules/_curses_panel.c
   python/branches/py3k-struni/Modules/_cursesmodule.c
   python/branches/py3k-struni/Modules/_elementtree.c
   python/branches/py3k-struni/Modules/_fileio.c
   python/branches/py3k-struni/Modules/_functoolsmodule.c
   python/branches/py3k-struni/Modules/_hashopenssl.c
   python/branches/py3k-struni/Modules/_hotshot.c
   python/branches/py3k-struni/Modules/_lsprof.c
   python/branches/py3k-struni/Modules/_randommodule.c
   python/branches/py3k-struni/Modules/_sqlite/cache.c
   python/branches/py3k-struni/Modules/_sqlite/connection.c
   python/branches/py3k-struni/Modules/_sqlite/cursor.c
   python/branches/py3k-struni/Modules/_sqlite/prepare_protocol.c
   python/branches/py3k-struni/Modules/_sqlite/row.c
   python/branches/py3k-struni/Modules/_sqlite/statement.c
   python/branches/py3k-struni/Modules/_sre.c
   python/branches/py3k-struni/Modules/_ssl.c
   python/branches/py3k-struni/Modules/_struct.c
   python/branches/py3k-struni/Modules/_testcapimodule.c
   python/branches/py3k-struni/Modules/_tkinter.c
   python/branches/py3k-struni/Modules/_typesmodule.c
   python/branches/py3k-struni/Modules/_weakref.c
   python/branches/py3k-struni/Modules/arraymodule.c
   python/branches/py3k-struni/Modules/bz2module.c
   python/branches/py3k-struni/Modules/cStringIO.c
   python/branches/py3k-struni/Modules/cjkcodecs/multibytecodec.c
   python/branches/py3k-struni/Modules/datetimemodule.c
   python/branches/py3k-struni/Modules/dbmmodule.c
   python/branches/py3k-struni/Modules/dlmodule.c
   python/branches/py3k-struni/Modules/gcmodule.c
   python/branches/py3k-struni/Modules/gdbmmodule.c
   python/branches/py3k-struni/Modules/itertoolsmodule.c
   python/branches/py3k-struni/Modules/linuxaudiodev.c
   python/branches/py3k-struni/Modules/mathmodule.c
   python/branches/py3k-struni/Modules/mmapmodule.c
   python/branches/py3k-struni/Modules/operator.c
   python/branches/py3k-struni/Modules/ossaudiodev.c
   python/branches/py3k-struni/Modules/parsermodule.c
   python/branches/py3k-struni/Modules/posixmodule.c
   python/branches/py3k-struni/Modules/pyexpat.c
   python/branches/py3k-struni/Modules/selectmodule.c
   python/branches/py3k-struni/Modules/sha256module.c
   python/branches/py3k-struni/Modules/sha512module.c
   python/branches/py3k-struni/Modules/socketmodule.c
   python/branches/py3k-struni/Modules/sunaudiodev.c
   python/branches/py3k-struni/Modules/threadmodule.c
   python/branches/py3k-struni/Modules/unicodedata.c
   python/branches/py3k-struni/Modules/xxmodule.c
   python/branches/py3k-struni/Modules/xxsubtype.c
   python/branches/py3k-struni/Modules/zipimport.c
   python/branches/py3k-struni/Modules/zlibmodule.c
   python/branches/py3k-struni/Objects/boolobject.c
   python/branches/py3k-struni/Objects/bufferobject.c
   python/branches/py3k-struni/Objects/bytesobject.c
   python/branches/py3k-struni/Objects/cellobject.c
   python/branches/py3k-struni/Objects/classobject.c
   python/branches/py3k-struni/Objects/cobject.c
   python/branches/py3k-struni/Objects/codeobject.c
   python/branches/py3k-struni/Objects/complexobject.c
   python/branches/py3k-struni/Objects/descrobject.c
   python/branches/py3k-struni/Objects/dictobject.c
   python/branches/py3k-struni/Objects/enumobject.c
   python/branches/py3k-struni/Objects/exceptions.c
   python/branches/py3k-struni/Objects/floatobject.c
   python/branches/py3k-struni/Objects/frameobject.c
   python/branches/py3k-struni/Objects/funcobject.c
   python/branches/py3k-struni/Objects/genobject.c
   python/branches/py3k-struni/Objects/intobject.c
   python/branches/py3k-struni/Objects/iterobject.c
   python/branches/py3k-struni/Objects/listobject.c
   python/branches/py3k-struni/Objects/longobject.c
   python/branches/py3k-struni/Objects/methodobject.c
   python/branches/py3k-struni/Objects/moduleobject.c
   python/branches/py3k-struni/Objects/object.c
   python/branches/py3k-struni/Objects/obmalloc.c
   python/branches/py3k-struni/Objects/rangeobject.c
   python/branches/py3k-struni/Objects/setobject.c
   python/branches/py3k-struni/Objects/sliceobject.c
   python/branches/py3k-struni/Objects/stringobject.c
   python/branches/py3k-struni/Objects/structseq.c
   python/branches/py3k-struni/Objects/tupleobject.c
   python/branches/py3k-struni/Objects/typeobject.c
   python/branches/py3k-struni/Objects/unicodeobject.c
   python/branches/py3k-struni/Objects/weakrefobject.c
   python/branches/py3k-struni/PC/_msi.c
   python/branches/py3k-struni/PC/_winreg.c
   python/branches/py3k-struni/Python/ceval.c
   python/branches/py3k-struni/Python/import.c
   python/branches/py3k-struni/Python/marshal.c
   python/branches/py3k-struni/Python/symtable.c
   python/branches/py3k-struni/Python/traceback.c
Log:
Merged revisions 56467-56482 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

................
  r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines
  
  Merged revisions 56466-56476 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines
    
    PEP 3123: Provide forward compatibility with Python 3.0, while keeping
    backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
    PyVarObject_HEAD_INIT.
  ........
................
  r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines
  
  PEP 3123: Use proper C inheritance for PyObject.
................
  r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines
  
  Add longintrepr.h to Python.h, so that the compiler can
  see that PyFalse is really some kind of PyObject*.
................
  r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines
  
  Qualify SHIFT, MASK, BASE.
................
  r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines
  
  Correctly refer to _ob_next.
................


Modified: python/branches/py3k-struni/Include/Python.h
==============================================================================
--- python/branches/py3k-struni/Include/Python.h	(original)
+++ python/branches/py3k-struni/Include/Python.h	Sat Jul 21 19:22:18 2007
@@ -67,8 +67,9 @@
 #include "bytesobject.h"
 #include "unicodeobject.h"
 #include "intobject.h"
-#include "boolobject.h"
 #include "longobject.h"
+#include "longintrepr.h"
+#include "boolobject.h"
 #include "floatobject.h"
 #ifndef WITHOUT_COMPLEX
 #include "complexobject.h"

Modified: python/branches/py3k-struni/Include/abstract.h
==============================================================================
--- python/branches/py3k-struni/Include/abstract.h	(original)
+++ python/branches/py3k-struni/Include/abstract.h	Sat Jul 21 19:22:18 2007
@@ -986,7 +986,7 @@
        */
 
 #define PySequence_ITEM(o, i)\
-	( o->ob_type->tp_as_sequence->sq_item(o, i) )
+	( Py_Type(o)->tp_as_sequence->sq_item(o, i) )
        /* Assume tp_as_sequence and sq_item exist and that i does not
 	  need to be corrected for a negative index
        */     

Modified: python/branches/py3k-struni/Include/boolobject.h
==============================================================================
--- python/branches/py3k-struni/Include/boolobject.h	(original)
+++ python/branches/py3k-struni/Include/boolobject.h	Sat Jul 21 19:22:18 2007
@@ -9,7 +9,7 @@
 
 PyAPI_DATA(PyTypeObject) PyBool_Type;
 
-#define PyBool_Check(x) ((x)->ob_type == &PyBool_Type)
+#define PyBool_Check(x) (Py_Type(x) == &PyBool_Type)
 
 /* Py_False and Py_True are the only two bools in existence.
 Don't forget to apply Py_INCREF() when returning either!!! */

Modified: python/branches/py3k-struni/Include/bufferobject.h
==============================================================================
--- python/branches/py3k-struni/Include/bufferobject.h	(original)
+++ python/branches/py3k-struni/Include/bufferobject.h	Sat Jul 21 19:22:18 2007
@@ -12,7 +12,7 @@
 
 PyAPI_DATA(PyTypeObject) PyBuffer_Type;
 
-#define PyBuffer_Check(op) ((op)->ob_type == &PyBuffer_Type)
+#define PyBuffer_Check(op) (Py_Type(op) == &PyBuffer_Type)
 
 #define Py_END_OF_BUFFER	(-1)
 

Modified: python/branches/py3k-struni/Include/bytesobject.h
==============================================================================
--- python/branches/py3k-struni/Include/bytesobject.h	(original)
+++ python/branches/py3k-struni/Include/bytesobject.h	Sat Jul 21 19:22:18 2007
@@ -30,7 +30,7 @@
 
 /* Type check macros */
 #define PyBytes_Check(self) PyObject_TypeCheck(self, &PyBytes_Type)
-#define PyBytes_CheckExact(self) ((self)->ob_type == &PyBytes_Type)
+#define PyBytes_CheckExact(self) (Py_Type(self) == &PyBytes_Type)
 
 /* Direct API functions */
 PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);

Modified: python/branches/py3k-struni/Include/cStringIO.h
==============================================================================
--- python/branches/py3k-struni/Include/cStringIO.h	(original)
+++ python/branches/py3k-struni/Include/cStringIO.h	Sat Jul 21 19:22:18 2007
@@ -60,9 +60,9 @@
 
 /* These can be used to test if you have one */
 #define PycStringIO_InputCheck(O) \
-  ((O)->ob_type==PycStringIO->InputType)
+  (Py_Type(O)==PycStringIO->InputType)
 #define PycStringIO_OutputCheck(O) \
-  ((O)->ob_type==PycStringIO->OutputType)
+  (Py_Type(O)==PycStringIO->OutputType)
 
 #ifdef __cplusplus
 }

Modified: python/branches/py3k-struni/Include/cellobject.h
==============================================================================
--- python/branches/py3k-struni/Include/cellobject.h	(original)
+++ python/branches/py3k-struni/Include/cellobject.h	Sat Jul 21 19:22:18 2007
@@ -13,7 +13,7 @@
 
 PyAPI_DATA(PyTypeObject) PyCell_Type;
 
-#define PyCell_Check(op) ((op)->ob_type == &PyCell_Type)
+#define PyCell_Check(op) (Py_Type(op) == &PyCell_Type)
 
 PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
 PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);

Modified: python/branches/py3k-struni/Include/cobject.h
==============================================================================
--- python/branches/py3k-struni/Include/cobject.h	(original)
+++ python/branches/py3k-struni/Include/cobject.h	Sat Jul 21 19:22:18 2007
@@ -16,7 +16,7 @@
 
 PyAPI_DATA(PyTypeObject) PyCObject_Type;
 
-#define PyCObject_Check(op) ((op)->ob_type == &PyCObject_Type)
+#define PyCObject_Check(op) (Py_Type(op) == &PyCObject_Type)
 
 /* Create a PyCObject from a pointer to a C object and an optional
    destructor function.  If the second argument is non-null, then it

Modified: python/branches/py3k-struni/Include/code.h
==============================================================================
--- python/branches/py3k-struni/Include/code.h	(original)
+++ python/branches/py3k-struni/Include/code.h	Sat Jul 21 19:22:18 2007
@@ -59,7 +59,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 {

Modified: python/branches/py3k-struni/Include/complexobject.h
==============================================================================
--- python/branches/py3k-struni/Include/complexobject.h	(original)
+++ python/branches/py3k-struni/Include/complexobject.h	Sat Jul 21 19:22:18 2007
@@ -43,7 +43,7 @@
 PyAPI_DATA(PyTypeObject) PyComplex_Type;
 
 #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
-#define PyComplex_CheckExact(op) ((op)->ob_type == &PyComplex_Type)
+#define PyComplex_CheckExact(op) (Py_Type(op) == &PyComplex_Type)
 
 PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
 PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);

Modified: python/branches/py3k-struni/Include/datetime.h
==============================================================================
--- python/branches/py3k-struni/Include/datetime.h	(original)
+++ python/branches/py3k-struni/Include/datetime.h	Sat Jul 21 19:22:18 2007
@@ -166,19 +166,19 @@
 
 /* Macros for type checking when building the Python core. */
 #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType)
-#define PyDate_CheckExact(op) ((op)->ob_type == &PyDateTime_DateType)
+#define PyDate_CheckExact(op) (Py_Type(op) == &PyDateTime_DateType)
 
 #define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType)
-#define PyDateTime_CheckExact(op) ((op)->ob_type == &PyDateTime_DateTimeType)
+#define PyDateTime_CheckExact(op) (Py_Type(op) == &PyDateTime_DateTimeType)
 
 #define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType)
-#define PyTime_CheckExact(op) ((op)->ob_type == &PyDateTime_TimeType)
+#define PyTime_CheckExact(op) (Py_Type(op) == &PyDateTime_TimeType)
 
 #define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType)
-#define PyDelta_CheckExact(op) ((op)->ob_type == &PyDateTime_DeltaType)
+#define PyDelta_CheckExact(op) (Py_Type(op) == &PyDateTime_DeltaType)
 
 #define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType)
-#define PyTZInfo_CheckExact(op) ((op)->ob_type == &PyDateTime_TZInfoType)
+#define PyTZInfo_CheckExact(op) (Py_Type(op) == &PyDateTime_TZInfoType)
 
 #else
 
@@ -198,19 +198,19 @@
 
 /* Macros for type checking when not building the Python core. */
 #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType)
-#define PyDate_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DateType)
+#define PyDate_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DateType)
 
 #define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType)
-#define PyDateTime_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DateTimeType)
+#define PyDateTime_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DateTimeType)
 
 #define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType)
-#define PyTime_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->TimeType)
+#define PyTime_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->TimeType)
 
 #define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType)
-#define PyDelta_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DeltaType)
+#define PyDelta_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->DeltaType)
 
 #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType)
-#define PyTZInfo_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->TZInfoType)
+#define PyTZInfo_CheckExact(op) (Py_Type(op) == PyDateTimeAPI->TZInfoType)
 
 /* Macros for accessing constructors in a simplified fashion. */
 #define PyDate_FromDate(year, month, day) \

Modified: python/branches/py3k-struni/Include/descrobject.h
==============================================================================
--- python/branches/py3k-struni/Include/descrobject.h	(original)
+++ python/branches/py3k-struni/Include/descrobject.h	Sat Jul 21 19:22:18 2007
@@ -77,7 +77,7 @@
 					       struct PyGetSetDef *);
 PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
 						struct wrapperbase *, void *);
-#define PyDescr_IsData(d) ((d)->ob_type->tp_descr_set != NULL)
+#define PyDescr_IsData(d) (Py_Type(d)->tp_descr_set != NULL)
 
 PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
 PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);

Modified: python/branches/py3k-struni/Include/dictobject.h
==============================================================================
--- python/branches/py3k-struni/Include/dictobject.h	(original)
+++ python/branches/py3k-struni/Include/dictobject.h	Sat Jul 21 19:22:18 2007
@@ -91,8 +91,8 @@
 PyAPI_DATA(PyTypeObject) PyDict_Type;
 
 #define PyDict_Check(op) \
-                 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_DICT_SUBCLASS)
-#define PyDict_CheckExact(op) ((op)->ob_type == &PyDict_Type)
+                 PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_DICT_SUBCLASS)
+#define PyDict_CheckExact(op) (Py_Type(op) == &PyDict_Type)
 
 PyAPI_FUNC(PyObject *) PyDict_New(void);
 PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);

Modified: python/branches/py3k-struni/Include/floatobject.h
==============================================================================
--- python/branches/py3k-struni/Include/floatobject.h	(original)
+++ python/branches/py3k-struni/Include/floatobject.h	Sat Jul 21 19:22:18 2007
@@ -19,7 +19,7 @@
 PyAPI_DATA(PyTypeObject) PyFloat_Type;
 
 #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
-#define PyFloat_CheckExact(op) ((op)->ob_type == &PyFloat_Type)
+#define PyFloat_CheckExact(op) (Py_Type(op) == &PyFloat_Type)
 
 /* Return Python float from string PyObject. */
 PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*);

Modified: python/branches/py3k-struni/Include/frameobject.h
==============================================================================
--- python/branches/py3k-struni/Include/frameobject.h	(original)
+++ python/branches/py3k-struni/Include/frameobject.h	Sat Jul 21 19:22:18 2007
@@ -51,7 +51,7 @@
 
 PyAPI_DATA(PyTypeObject) PyFrame_Type;
 
-#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
+#define PyFrame_Check(op) (Py_Type(op) == &PyFrame_Type)
 
 PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
                                        PyObject *, PyObject *);

Modified: python/branches/py3k-struni/Include/funcobject.h
==============================================================================
--- python/branches/py3k-struni/Include/funcobject.h	(original)
+++ python/branches/py3k-struni/Include/funcobject.h	Sat Jul 21 19:22:18 2007
@@ -41,7 +41,7 @@
 
 PyAPI_DATA(PyTypeObject) PyFunction_Type;
 
-#define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)
+#define PyFunction_Check(op) (Py_Type(op) == &PyFunction_Type)
 
 PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
 PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *);

Modified: python/branches/py3k-struni/Include/genobject.h
==============================================================================
--- python/branches/py3k-struni/Include/genobject.h	(original)
+++ python/branches/py3k-struni/Include/genobject.h	Sat Jul 21 19:22:18 2007
@@ -26,7 +26,7 @@
 PyAPI_DATA(PyTypeObject) PyGen_Type;
 
 #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
-#define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type)
+#define PyGen_CheckExact(op) (Py_Type(op) == &PyGen_Type)
 
 PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
 PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);

Modified: python/branches/py3k-struni/Include/iterobject.h
==============================================================================
--- python/branches/py3k-struni/Include/iterobject.h	(original)
+++ python/branches/py3k-struni/Include/iterobject.h	Sat Jul 21 19:22:18 2007
@@ -7,13 +7,13 @@
 
 PyAPI_DATA(PyTypeObject) PySeqIter_Type;
 
-#define PySeqIter_Check(op) ((op)->ob_type == &PySeqIter_Type)
+#define PySeqIter_Check(op) (Py_Type(op) == &PySeqIter_Type)
 
 PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
 
 PyAPI_DATA(PyTypeObject) PyCallIter_Type;
 
-#define PyCallIter_Check(op) ((op)->ob_type == &PyCallIter_Type)
+#define PyCallIter_Check(op) (Py_Type(op) == &PyCallIter_Type)
 
 PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
 

Modified: python/branches/py3k-struni/Include/listobject.h
==============================================================================
--- python/branches/py3k-struni/Include/listobject.h	(original)
+++ python/branches/py3k-struni/Include/listobject.h	Sat Jul 21 19:22:18 2007
@@ -41,8 +41,8 @@
 PyAPI_DATA(PyTypeObject) PyList_Type;
 
 #define PyList_Check(op) \
-		PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_LIST_SUBCLASS)
-#define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type)
+		PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LIST_SUBCLASS)
+#define PyList_CheckExact(op) (Py_Type(op) == &PyList_Type)
 
 PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
 PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
@@ -60,7 +60,7 @@
 /* Macro, trading safety for speed */
 #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
 #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
-#define PyList_GET_SIZE(op)    (((PyListObject *)(op))->ob_size)
+#define PyList_GET_SIZE(op)    Py_Size(op)
 
 #ifdef __cplusplus
 }

Modified: python/branches/py3k-struni/Include/longintrepr.h
==============================================================================
--- python/branches/py3k-struni/Include/longintrepr.h	(original)
+++ python/branches/py3k-struni/Include/longintrepr.h	Sat Jul 21 19:22:18 2007
@@ -24,11 +24,11 @@
 typedef unsigned BASE_TWODIGITS_TYPE twodigits;
 typedef BASE_TWODIGITS_TYPE stwodigits; /* signed variant of twodigits */
 
-#define SHIFT	15
-#define BASE	((digit)1 << SHIFT)
-#define MASK	((int)(BASE - 1))
+#define PyLong_SHIFT	15
+#define PyLong_BASE	((digit)1 << PyLong_SHIFT)
+#define PyLong_MASK	((int)(PyLong_BASE - 1))
 
-#if SHIFT % 5 != 0
+#if PyLong_SHIFT % 5 != 0
 #error "longobject.c requires that SHIFT be divisible by 5"
 #endif
 

Modified: python/branches/py3k-struni/Include/longobject.h
==============================================================================
--- python/branches/py3k-struni/Include/longobject.h	(original)
+++ python/branches/py3k-struni/Include/longobject.h	Sat Jul 21 19:22:18 2007
@@ -12,8 +12,8 @@
 PyAPI_DATA(PyTypeObject) PyLong_Type;
 
 #define PyLong_Check(op) \
-		PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_LONG_SUBCLASS)
-#define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type)
+		PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LONG_SUBCLASS)
+#define PyLong_CheckExact(op) (Py_Type(op) == &PyLong_Type)
 
 PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
 PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);

Modified: python/branches/py3k-struni/Include/methodobject.h
==============================================================================
--- python/branches/py3k-struni/Include/methodobject.h	(original)
+++ python/branches/py3k-struni/Include/methodobject.h	Sat Jul 21 19:22:18 2007
@@ -13,7 +13,7 @@
 
 PyAPI_DATA(PyTypeObject) PyCFunction_Type;
 
-#define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
+#define PyCFunction_Check(op) (Py_Type(op) == &PyCFunction_Type)
 
 typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
 typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,

Modified: python/branches/py3k-struni/Include/moduleobject.h
==============================================================================
--- python/branches/py3k-struni/Include/moduleobject.h	(original)
+++ python/branches/py3k-struni/Include/moduleobject.h	Sat Jul 21 19:22:18 2007
@@ -10,7 +10,7 @@
 PyAPI_DATA(PyTypeObject) PyModule_Type;
 
 #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
-#define PyModule_CheckExact(op) ((op)->ob_type == &PyModule_Type)
+#define PyModule_CheckExact(op) (Py_Type(op) == &PyModule_Type)
 
 PyAPI_FUNC(PyObject *) PyModule_New(const char *);
 PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);

Modified: python/branches/py3k-struni/Include/object.h
==============================================================================
--- python/branches/py3k-struni/Include/object.h	(original)
+++ python/branches/py3k-struni/Include/object.h	Sat Jul 21 19:22:18 2007
@@ -75,14 +75,14 @@
 #endif
 
 /* PyObject_HEAD defines the initial segment of every PyObject. */
-#define PyObject_HEAD			\
-	_PyObject_HEAD_EXTRA		\
-	Py_ssize_t ob_refcnt;		\
-	struct _typeobject *ob_type;
+#define PyObject_HEAD		        PyObject ob_base;
 
 #define PyObject_HEAD_INIT(type)	\
-	_PyObject_EXTRA_INIT		\
-	1, type,
+	{ _PyObject_EXTRA_INIT		\
+	1, type },
+
+#define PyVarObject_HEAD_INIT(type, size)	\
+	{ PyObject_HEAD_INIT(type) size },
 
 /* PyObject_VAR_HEAD defines the initial segment of all variable-size
  * container objects.  These end with a declaration of an array with 1
@@ -90,9 +90,7 @@
  * has room for ob_size elements.  Note that ob_size is an element count,
  * not necessarily a byte count.
  */
-#define PyObject_VAR_HEAD		\
-	PyObject_HEAD			\
-	Py_ssize_t ob_size; /* Number of items in variable part */
+#define PyObject_VAR_HEAD      PyVarObject ob_base;
 #define Py_INVALID_SIZE (Py_ssize_t)-1
 
 /* Nothing is actually declared to be a PyObject, but every pointer to
@@ -101,13 +99,19 @@
  * in addition, be cast to PyVarObject*.
  */
 typedef struct _object {
-	PyObject_HEAD
+	_PyObject_HEAD_EXTRA
+	Py_ssize_t ob_refcnt;
+	struct _typeobject *ob_type;
 } PyObject;
 
 typedef struct {
-	PyObject_VAR_HEAD
+	PyObject ob_base;
+	Py_ssize_t ob_size; /* Number of items in variable part */
 } PyVarObject;
 
+#define Py_Refcnt(ob)		(((PyObject*)(ob))->ob_refcnt)
+#define Py_Type(ob)		(((PyObject*)(ob))->ob_type)
+#define Py_Size(ob)		(((PyVarObject*)(ob))->ob_size)
 
 /*
 Type objects contain a string containing the type name (to help somewhat
@@ -346,21 +350,21 @@
 
 /* access macro to the members which are floating "behind" the object */
 #define PyHeapType_GET_MEMBERS(etype) \
-    ((PyMemberDef *)(((char *)etype) + (etype)->ht_type.ob_type->tp_basicsize))
+    ((PyMemberDef *)(((char *)etype) + Py_Type(etype)->tp_basicsize))
 
 
 /* Generic type check */
 PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
 #define PyObject_TypeCheck(ob, tp) \
-	((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))
+	(Py_Type(ob) == (tp) || PyType_IsSubtype(Py_Type(ob), (tp)))
 
 PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
 PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
 PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
 
 #define PyType_Check(op) \
-	PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TYPE_SUBCLASS)
-#define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type)
+	PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TYPE_SUBCLASS)
+#define PyType_CheckExact(op) (Py_Type(op) == &PyType_Type)
 
 PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
 PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
@@ -543,7 +547,7 @@
 #define _Py_DEC_REFTOTAL	_Py_RefTotal--
 #define _Py_REF_DEBUG_COMMA	,
 #define _Py_CHECK_REFCNT(OP)					\
-{	if ((OP)->ob_refcnt < 0)				\
+{	if (((PyObject*)OP)->ob_refcnt < 0)				\
 		_Py_NegativeRefcount(__FILE__, __LINE__,	\
 				     (PyObject *)(OP));		\
 }
@@ -557,9 +561,9 @@
 #ifdef COUNT_ALLOCS
 PyAPI_FUNC(void) inc_count(PyTypeObject *);
 PyAPI_FUNC(void) dec_count(PyTypeObject *);
-#define _Py_INC_TPALLOCS(OP)	inc_count((OP)->ob_type)
-#define _Py_INC_TPFREES(OP)	dec_count((OP)->ob_type)
-#define _Py_DEC_TPFREES(OP)	(OP)->ob_type->tp_frees--
+#define _Py_INC_TPALLOCS(OP)	inc_count(Py_Type(OP))
+#define _Py_INC_TPFREES(OP)	dec_count(Py_Type(OP))
+#define _Py_DEC_TPFREES(OP)	Py_Type(OP)->tp_frees--
 #define _Py_COUNT_ALLOCS_COMMA	,
 #else
 #define _Py_INC_TPALLOCS(OP)
@@ -584,22 +588,22 @@
 #define _Py_NewReference(op) (				\
 	_Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA	\
 	_Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA		\
-	(op)->ob_refcnt = 1)
+	Py_Refcnt(op) = 1)
 
 #define _Py_ForgetReference(op) _Py_INC_TPFREES(op)
 
 #define _Py_Dealloc(op) (				\
 	_Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA	\
-	(*(op)->ob_type->tp_dealloc)((PyObject *)(op)))
+	(*Py_Type(op)->tp_dealloc)((PyObject *)(op)))
 #endif /* !Py_TRACE_REFS */
 
 #define Py_INCREF(op) (				\
 	_Py_INC_REFTOTAL  _Py_REF_DEBUG_COMMA	\
-	(op)->ob_refcnt++)
+	((PyObject*)(op))->ob_refcnt++)
 
 #define Py_DECREF(op)					\
 	if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA	\
-	    --(op)->ob_refcnt != 0)			\
+	    --((PyObject*)(op))->ob_refcnt != 0)		\
 		_Py_CHECK_REFCNT(op)			\
 	else						\
 		_Py_Dealloc((PyObject *)(op))

Modified: python/branches/py3k-struni/Include/objimpl.h
==============================================================================
--- python/branches/py3k-struni/Include/objimpl.h	(original)
+++ python/branches/py3k-struni/Include/objimpl.h	Sat Jul 21 19:22:18 2007
@@ -154,9 +154,9 @@
 /* Macros trading binary compatibility for speed. See also pymem.h.
    Note that these macros expect non-NULL object pointers.*/
 #define PyObject_INIT(op, typeobj) \
-	( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
+	( Py_Type(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) )
 #define PyObject_INIT_VAR(op, typeobj, size) \
-	( (op)->ob_size = (size), PyObject_INIT((op), (typeobj)) )
+	( Py_Size(op) = (size), PyObject_INIT((op), (typeobj)) )
 
 #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
 
@@ -231,8 +231,8 @@
 #define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
 
 /* Test if an object has a GC head */
-#define PyObject_IS_GC(o) (PyType_IS_GC((o)->ob_type) && \
-	((o)->ob_type->tp_is_gc == NULL || (o)->ob_type->tp_is_gc(o)))
+#define PyObject_IS_GC(o) (PyType_IS_GC(Py_Type(o)) && \
+	(Py_Type(o)->tp_is_gc == NULL || Py_Type(o)->tp_is_gc(o)))
 
 PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
 #define PyObject_GC_Resize(type, op, n) \
@@ -326,7 +326,7 @@
 #define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
 
 #define PyObject_GET_WEAKREFS_LISTPTR(o) \
-	((PyObject **) (((char *) (o)) + (o)->ob_type->tp_weaklistoffset))
+	((PyObject **) (((char *) (o)) + Py_Type(o)->tp_weaklistoffset))
 
 #ifdef __cplusplus
 }

Modified: python/branches/py3k-struni/Include/py_curses.h
==============================================================================
--- python/branches/py3k-struni/Include/py_curses.h	(original)
+++ python/branches/py3k-struni/Include/py_curses.h	Sat Jul 21 19:22:18 2007
@@ -73,7 +73,7 @@
 	WINDOW *win;
 } PyCursesWindowObject;
 
-#define PyCursesWindow_Check(v)	 ((v)->ob_type == &PyCursesWindow_Type)
+#define PyCursesWindow_Check(v)	 (Py_Type(v) == &PyCursesWindow_Type)
 
 #ifdef CURSES_MODULE
 /* This section is used when compiling _cursesmodule.c */

Modified: python/branches/py3k-struni/Include/rangeobject.h
==============================================================================
--- python/branches/py3k-struni/Include/rangeobject.h	(original)
+++ python/branches/py3k-struni/Include/rangeobject.h	Sat Jul 21 19:22:18 2007
@@ -17,7 +17,7 @@
 
 PyAPI_DATA(PyTypeObject) PyRange_Type;
 
-#define PyRange_Check(op) ((op)->ob_type == &PyRange_Type)
+#define PyRange_Check(op) (Py_Type(op) == &PyRange_Type)
 
 #ifdef __cplusplus
 }

Modified: python/branches/py3k-struni/Include/setobject.h
==============================================================================
--- python/branches/py3k-struni/Include/setobject.h	(original)
+++ python/branches/py3k-struni/Include/setobject.h	Sat Jul 21 19:22:18 2007
@@ -66,13 +66,13 @@
  *     hash is -1
  */
 
-#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
+#define PyFrozenSet_CheckExact(ob) (Py_Type(ob) == &PyFrozenSet_Type)
 #define PyAnySet_CheckExact(ob) \
-	((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type)
+	(Py_Type(ob) == &PySet_Type || Py_Type(ob) == &PyFrozenSet_Type)
 #define PyAnySet_Check(ob) \
-	((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \
-	  PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
-	  PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
+	(Py_Type(ob) == &PySet_Type || Py_Type(ob) == &PyFrozenSet_Type || \
+	  PyType_IsSubtype(Py_Type(ob), &PySet_Type) || \
+	  PyType_IsSubtype(Py_Type(ob), &PyFrozenSet_Type))
 
 PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
 PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);

Modified: python/branches/py3k-struni/Include/sliceobject.h
==============================================================================
--- python/branches/py3k-struni/Include/sliceobject.h	(original)
+++ python/branches/py3k-struni/Include/sliceobject.h	Sat Jul 21 19:22:18 2007
@@ -26,7 +26,7 @@
 
 PyAPI_DATA(PyTypeObject) PySlice_Type;
 
-#define PySlice_Check(op) ((op)->ob_type == &PySlice_Type)
+#define PySlice_Check(op) (Py_Type(op) == &PySlice_Type)
 
 PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
                                   PyObject* step);

Modified: python/branches/py3k-struni/Include/stringobject.h
==============================================================================
--- python/branches/py3k-struni/Include/stringobject.h	(original)
+++ python/branches/py3k-struni/Include/stringobject.h	Sat Jul 21 19:22:18 2007
@@ -52,8 +52,8 @@
 PyAPI_DATA(PyTypeObject) PyString_Type;
 
 #define PyString_Check(op) \
-                 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_STRING_SUBCLASS)
-#define PyString_CheckExact(op) ((op)->ob_type == &PyString_Type)
+                 PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_STRING_SUBCLASS)
+#define PyString_CheckExact(op) (Py_Type(op) == &PyString_Type)
 
 PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
 PyAPI_FUNC(PyObject *) PyString_FromString(const char *);

Modified: python/branches/py3k-struni/Include/symtable.h
==============================================================================
--- python/branches/py3k-struni/Include/symtable.h	(original)
+++ python/branches/py3k-struni/Include/symtable.h	Sat Jul 21 19:22:18 2007
@@ -53,7 +53,7 @@
 
 PyAPI_DATA(PyTypeObject) PySTEntry_Type;
 
-#define PySTEntry_Check(op) ((op)->ob_type == &PySTEntry_Type)
+#define PySTEntry_Check(op) (Py_Type(op) == &PySTEntry_Type)
 
 PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *);
 

Modified: python/branches/py3k-struni/Include/traceback.h
==============================================================================
--- python/branches/py3k-struni/Include/traceback.h	(original)
+++ python/branches/py3k-struni/Include/traceback.h	Sat Jul 21 19:22:18 2007
@@ -22,7 +22,7 @@
 
 /* Reveal traceback type so we can typecheck traceback objects */
 PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
-#define PyTraceBack_Check(v) ((v)->ob_type == &PyTraceBack_Type)
+#define PyTraceBack_Check(v) (Py_Type(v) == &PyTraceBack_Type)
 
 #ifdef __cplusplus
 }

Modified: python/branches/py3k-struni/Include/tupleobject.h
==============================================================================
--- python/branches/py3k-struni/Include/tupleobject.h	(original)
+++ python/branches/py3k-struni/Include/tupleobject.h	Sat Jul 21 19:22:18 2007
@@ -34,8 +34,8 @@
 PyAPI_DATA(PyTypeObject) PyTuple_Type;
 
 #define PyTuple_Check(op) \
-                 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_TUPLE_SUBCLASS)
-#define PyTuple_CheckExact(op) ((op)->ob_type == &PyTuple_Type)
+                 PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TUPLE_SUBCLASS)
+#define PyTuple_CheckExact(op) (Py_Type(op) == &PyTuple_Type)
 
 PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
 PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
@@ -47,7 +47,7 @@
 
 /* Macro, trading safety for speed */
 #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])
-#define PyTuple_GET_SIZE(op)    (((PyTupleObject *)(op))->ob_size)
+#define PyTuple_GET_SIZE(op)    Py_Size(op)
 
 /* Macro, *only* to be used to fill in brand new tuples */
 #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)

Modified: python/branches/py3k-struni/Include/unicodeobject.h
==============================================================================
--- python/branches/py3k-struni/Include/unicodeobject.h	(original)
+++ python/branches/py3k-struni/Include/unicodeobject.h	Sat Jul 21 19:22:18 2007
@@ -405,8 +405,8 @@
 #define SSTATE_INTERNED_IMMORTAL 2
 
 #define PyUnicode_Check(op) \
-                 PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_UNICODE_SUBCLASS)
-#define PyUnicode_CheckExact(op) ((op)->ob_type == &PyUnicode_Type)
+                 PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_UNICODE_SUBCLASS)
+#define PyUnicode_CheckExact(op) (Py_Type(op) == &PyUnicode_Type)
 
 /* Fast access macros */
 #define PyUnicode_GET_SIZE(op) \

Modified: python/branches/py3k-struni/Include/weakrefobject.h
==============================================================================
--- python/branches/py3k-struni/Include/weakrefobject.h	(original)
+++ python/branches/py3k-struni/Include/weakrefobject.h	Sat Jul 21 19:22:18 2007
@@ -44,10 +44,10 @@
 
 #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType)
 #define PyWeakref_CheckRefExact(op) \
-        ((op)->ob_type == &_PyWeakref_RefType)
+        (Py_Type(op) == &_PyWeakref_RefType)
 #define PyWeakref_CheckProxy(op) \
-        (((op)->ob_type == &_PyWeakref_ProxyType) || \
-         ((op)->ob_type == &_PyWeakref_CallableProxyType))
+        ((Py_Type(op) == &_PyWeakref_ProxyType) || \
+         (Py_Type(op) == &_PyWeakref_CallableProxyType))
 
 /* This macro calls PyWeakref_CheckRef() last since that can involve a
    function call; this makes it more likely that the function call

Modified: python/branches/py3k-struni/Misc/NEWS
==============================================================================
--- python/branches/py3k-struni/Misc/NEWS	(original)
+++ python/branches/py3k-struni/Misc/NEWS	Sat Jul 21 19:22:18 2007
@@ -26,6 +26,8 @@
 Core and Builtins
 -----------------
 
+- PEP 3123: Use proper C inheritance for PyObject.
+
 - Removed the __oct__ and __hex__ special methods and added a bin()
   builtin function.
 

Modified: python/branches/py3k-struni/Modules/_bsddb.c
==============================================================================
--- python/branches/py3k-struni/Modules/_bsddb.c	(original)
+++ python/branches/py3k-struni/Modules/_bsddb.c	Sat Jul 21 19:22:18 2007
@@ -300,13 +300,13 @@
 
 static PyTypeObject DB_Type, DBCursor_Type, DBEnv_Type, DBTxn_Type, DBLock_Type;
 
-#define DBObject_Check(v)           ((v)->ob_type == &DB_Type)
-#define DBCursorObject_Check(v)     ((v)->ob_type == &DBCursor_Type)
-#define DBEnvObject_Check(v)        ((v)->ob_type == &DBEnv_Type)
-#define DBTxnObject_Check(v)        ((v)->ob_type == &DBTxn_Type)
-#define DBLockObject_Check(v)       ((v)->ob_type == &DBLock_Type)
+#define DBObject_Check(v)           (Py_Type(v) == &DB_Type)
+#define DBCursorObject_Check(v)     (Py_Type(v) == &DBCursor_Type)
+#define DBEnvObject_Check(v)        (Py_Type(v) == &DBEnv_Type)
+#define DBTxnObject_Check(v)        (Py_Type(v) == &DBTxn_Type)
+#define DBLockObject_Check(v)       (Py_Type(v) == &DBLock_Type)
 #if (DBVER >= 43)
-#define DBSequenceObject_Check(v)   ((v)->ob_type == &DBSequence_Type)
+#define DBSequenceObject_Check(v)   (Py_Type(v) == &DBSequence_Type)
 #endif
 
 
@@ -461,7 +461,7 @@
     else {
         PyErr_Format(PyExc_TypeError,
                      "String or Integer object expected for key, %s found",
-                     keyobj->ob_type->tp_name);
+                     Py_Type(keyobj)->tp_name);
         return 0;
     }
 
@@ -616,7 +616,7 @@
 static void makeTypeError(char* expected, PyObject* found)
 {
     PyErr_Format(PyExc_TypeError, "Expected %s argument, %s found.",
-                 expected, found->ob_type->tp_name);
+                 expected, Py_Type(found)->tp_name);
 }
 
 
@@ -5369,8 +5369,7 @@
 #endif
 
 static PyTypeObject DB_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,                  /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "DB",               /*tp_name*/
     sizeof(DBObject),   /*tp_basicsize*/
     0,                  /*tp_itemsize*/
@@ -5402,8 +5401,7 @@
 
 
 static PyTypeObject DBCursor_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,                  /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "DBCursor",         /*tp_name*/
     sizeof(DBCursorObject),  /*tp_basicsize*/
     0,                  /*tp_itemsize*/
@@ -5435,8 +5433,7 @@
 
 
 static PyTypeObject DBEnv_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,          /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "DBEnv",            /*tp_name*/
     sizeof(DBEnvObject),    /*tp_basicsize*/
     0,          /*tp_itemsize*/
@@ -5467,8 +5464,7 @@
 };
 
 static PyTypeObject DBTxn_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,          /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "DBTxn",    /*tp_name*/
     sizeof(DBTxnObject),  /*tp_basicsize*/
     0,          /*tp_itemsize*/
@@ -5500,8 +5496,7 @@
 
 
 static PyTypeObject DBLock_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,          /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "DBLock",   /*tp_name*/
     sizeof(DBLockObject),  /*tp_basicsize*/
     0,          /*tp_itemsize*/
@@ -5533,8 +5528,7 @@
 
 #if (DBVER >= 43)
 static PyTypeObject DBSequence_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,          /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "DBSequence",                   /*tp_name*/
     sizeof(DBSequenceObject),       /*tp_basicsize*/
     0,          /*tp_itemsize*/
@@ -5666,13 +5660,13 @@
 
     /* Initialize the type of the new type objects here; doing it here
        is required for portability to Windows without requiring C++. */
-    DB_Type.ob_type = &PyType_Type;
-    DBCursor_Type.ob_type = &PyType_Type;
-    DBEnv_Type.ob_type = &PyType_Type;
-    DBTxn_Type.ob_type = &PyType_Type;
-    DBLock_Type.ob_type = &PyType_Type;
+    Py_Type(&DB_Type) = &PyType_Type;
+    Py_Type(&DBCursor_Type) = &PyType_Type;
+    Py_Type(&DBEnv_Type) = &PyType_Type;
+    Py_Type(&DBTxn_Type) = &PyType_Type;
+    Py_Type(&DBLock_Type) = &PyType_Type;
 #if (DBVER >= 43)    
-    DBSequence_Type.ob_type = &PyType_Type;
+    Py_Type(&DBSequence_Type) = &PyType_Type;
 #endif    
 
 

Modified: python/branches/py3k-struni/Modules/_collectionsmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/_collectionsmodule.c	(original)
+++ python/branches/py3k-struni/Modules/_collectionsmodule.c	Sat Jul 21 19:22:18 2007
@@ -544,7 +544,7 @@
 	}
 	deque->leftblock = NULL;
 	deque->rightblock = NULL;
-	deque->ob_type->tp_free(deque);
+	Py_Type(deque)->tp_free(deque);
 }
 
 static int
@@ -579,7 +579,7 @@
 static PyObject *
 deque_copy(PyObject *deque)
 {
-	return PyObject_CallFunctionObjArgs((PyObject *)(deque->ob_type),
+	return PyObject_CallFunctionObjArgs((PyObject *)(Py_Type(deque)),
 		deque, NULL);
 }
 
@@ -601,7 +601,7 @@
 		Py_DECREF(dict);
 		return NULL;
 	}
-	result = Py_BuildValue("O()ON", deque->ob_type, dict, it);
+	result = Py_BuildValue("O()ON", Py_Type(deque), dict, it);
 	Py_DECREF(dict);
 	return result;
 }
@@ -818,8 +818,7 @@
 Build an ordered collection accessible from endpoints only.");
 
 static PyTypeObject deque_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"collections.deque",		/* tp_name */
 	sizeof(dequeobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -896,7 +895,7 @@
 dequeiter_dealloc(dequeiterobject *dio)
 {
 	Py_XDECREF(dio->deque);
-	dio->ob_type->tp_free(dio);
+	Py_Type(dio)->tp_free(dio);
 }
 
 static PyObject *
@@ -941,8 +940,7 @@
 };
 
 PyTypeObject dequeiter_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"deque_iterator",			/* tp_name */
 	sizeof(dequeiterobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1024,8 +1022,7 @@
 }
 
 PyTypeObject dequereviter_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"deque_reverse_iterator",		/* tp_name */
 	sizeof(dequeiterobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1106,7 +1103,7 @@
 	   whose class constructor has the same signature.  Subclasses that
 	   define a different constructor signature must override copy().
 	*/
-	return PyObject_CallFunctionObjArgs((PyObject *)dd->dict.ob_type,
+	return PyObject_CallFunctionObjArgs(Py_Type(dd),
 					    dd->default_factory, dd, NULL);
 }
 
@@ -1149,7 +1146,7 @@
 		Py_DECREF(args);
 		return NULL;
 	}
-	result = PyTuple_Pack(5, dd->dict.ob_type, args,
+	result = PyTuple_Pack(5, Py_Type(dd), args,
 			      Py_None, Py_None, items);
 	Py_DECREF(items);
 	Py_DECREF(args);
@@ -1274,8 +1271,7 @@
 #define DEFERRED_ADDRESS(ADDR) 0
 
 static PyTypeObject defdict_type = {
-	PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type))
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0)
 	"collections.defaultdict",	/* tp_name */
 	sizeof(defdictobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_csv.c
==============================================================================
--- python/branches/py3k-struni/Modules/_csv.c	(original)
+++ python/branches/py3k-struni/Modules/_csv.c	Sat Jul 21 19:22:18 2007
@@ -125,7 +125,7 @@
 
 static PyTypeObject Reader_Type;
 
-#define ReaderObject_Check(v)   ((v)->ob_type == &Reader_Type)
+#define ReaderObject_Check(v)   (Py_Type(v) == &Reader_Type)
 
 typedef struct {
         PyObject_HEAD
@@ -310,7 +310,7 @@
 Dialect_dealloc(DialectObj *self)
 {
         Py_XDECREF(self->lineterminator);
-        self->ob_type->tp_free((PyObject *)self);
+        Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static char *dialect_kws[] = {
@@ -460,8 +460,7 @@
 "The Dialect type records CSV parsing and generation options.\n");
 
 static PyTypeObject Dialect_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,                                      /* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_csv.Dialect",                         /* tp_name */
 	sizeof(DialectObj),                     /* tp_basicsize */
 	0,                                      /* tp_itemsize */
@@ -869,8 +868,7 @@
 
 
 static PyTypeObject Reader_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,                                      /*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_csv.reader",                          /*tp_name*/
 	sizeof(ReaderObj),                      /*tp_basicsize*/
 	0,                                      /*tp_itemsize*/
@@ -1280,8 +1278,7 @@
 );
 
 static PyTypeObject Writer_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,                                      /*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_csv.writer",                          /*tp_name*/
 	sizeof(WriterObj),                      /*tp_basicsize*/
 	0,                                      /*tp_itemsize*/

Modified: python/branches/py3k-struni/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k-struni/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/py3k-struni/Modules/_ctypes/_ctypes.c	Sat Jul 21 19:22:18 2007
@@ -328,7 +328,7 @@
 			Py_INCREF(value);
 			return value;
 		}
-		ob_name = (ob) ? ob->ob_type->tp_name : "???";
+		ob_name = (ob) ? Py_Type(ob)->tp_name : "???";
 		PyErr_Format(PyExc_TypeError,
 			     "expected %s instance instead of pointer to %s",
 			     ((PyTypeObject *)type)->tp_name, ob_name);
@@ -344,7 +344,7 @@
 	PyErr_Format(PyExc_TypeError,
 		     "expected %s instance instead of %s",
 		     ((PyTypeObject *)type)->tp_name,
-		     value->ob_type->tp_name);
+		     Py_Type(value)->tp_name);
 	return NULL;
 }
 
@@ -427,8 +427,7 @@
 
 
 PyTypeObject StructType_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.StructType",			/* tp_name */
 	0,					/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -470,8 +469,7 @@
 };
 
 static PyTypeObject UnionType_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.UnionType",			/* tp_name */
 	0,					/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -685,8 +683,7 @@
 };
 
 PyTypeObject PointerType_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.PointerType",				/* tp_name */
 	0,					/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -743,7 +740,7 @@
 	char *ptr;
 	Py_ssize_t size;
 	if (PyBuffer_Check(value)) {
-		size = value->ob_type->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr);
+		size = Py_Type(value)->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr);
 		if (size < 0)
 			return -1;
 	} else if (-1 == PyString_AsStringAndSize(value, &ptr, &size)) {
@@ -792,7 +789,7 @@
 	} else if (!PyBytes_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 			     "str/bytes expected instead of %s instance",
-			     value->ob_type->tp_name);
+			     Py_Type(value)->tp_name);
 		return -1;
 	} else
 		Py_INCREF(value);
@@ -847,7 +844,7 @@
 	} else if (!PyUnicode_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 				"unicode string expected instead of %s instance",
-				value->ob_type->tp_name);
+				Py_Type(value)->tp_name);
 		return -1;
 	} else
 		Py_INCREF(value);
@@ -1043,8 +1040,7 @@
 }
 
 PyTypeObject ArrayType_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.ArrayType",			/* tp_name */
 	0,					/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1682,8 +1678,7 @@
 };
 
 PyTypeObject SimpleType_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.SimpleType",				/* tp_name */
 	0,					/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1893,8 +1888,7 @@
 }
 
 PyTypeObject CFuncPtrType_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.CFuncPtrType",			/* tp_name */
 	0,					/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2062,7 +2056,7 @@
 CData_dealloc(PyObject *self)
 {
 	CData_clear((CDataObject *)self);
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static PyMemberDef CData_members[] = {
@@ -2129,8 +2123,7 @@
 };
 
 PyTypeObject CData_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes._CData",
 	sizeof(CDataObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2336,7 +2329,7 @@
 			PyErr_Format(PyExc_TypeError,
 				     "expected %s instance, got %s",
 				     ((PyTypeObject *)type)->tp_name,
-				     value->ob_type->tp_name);
+				     Py_Type(value)->tp_name);
 			return NULL;
 		}
 	}
@@ -2367,7 +2360,7 @@
 		if (p1->proto != p2->proto) {
 			PyErr_Format(PyExc_TypeError,
 				     "incompatible types, %s instance instead of %s instance",
-				     value->ob_type->tp_name,
+				     Py_Type(value)->tp_name,
 				     ((PyTypeObject *)type)->tp_name);
 			return NULL;
 		}
@@ -2386,7 +2379,7 @@
 	}
 	PyErr_Format(PyExc_TypeError,
 		     "incompatible types, %s instance instead of %s instance",
-		     value->ob_type->tp_name,
+		     Py_Type(value)->tp_name,
 		     ((PyTypeObject *)type)->tp_name);
 	return NULL;
 }
@@ -2647,7 +2640,7 @@
 		     Py_SAFE_DOWNCAST(index, Py_ssize_t, int),
 		     PyType_Check(arg) ?
 		     ((PyTypeObject *)arg)->tp_name :
-		     arg->ob_type->tp_name);
+		     Py_Type(arg)->tp_name);
 	return 0;
 }
 
@@ -3429,7 +3422,7 @@
 CFuncPtr_dealloc(CFuncPtrObject *self)
 {
 	CFuncPtr_clear(self);
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static PyObject *
@@ -3439,17 +3432,16 @@
 	if (self->index)
 		return PyUnicode_FromFormat("<COM method offset %d: %s at %p>",
 					   self->index - 0x1000,
-					   self->ob_type->tp_name,
+					   Py_Type(self)->tp_name,
 					   self);
 #endif
 	return PyUnicode_FromFormat("<%s object at %p>",
-				   self->ob_type->tp_name,
+				   Py_Type(self)->tp_name,
 				   self);
 }
 
 PyTypeObject CFuncPtr_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.CFuncPtr",
 	sizeof(CFuncPtrObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3577,8 +3569,7 @@
 }
 
 static PyTypeObject Struct_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.Structure",
 	sizeof(CDataObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3620,8 +3611,7 @@
 };
 
 static PyTypeObject Union_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.Union",
 	sizeof(CDataObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3853,8 +3843,7 @@
 };
 
 PyTypeObject Array_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.Array",
 	sizeof(CDataObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3999,7 +3988,7 @@
 static PyObject *
 Simple_from_outparm(PyObject *self, PyObject *args)
 {
-	if (IsSimpleSubType((PyObject *)self->ob_type)) {
+	if (IsSimpleSubType((PyObject *)Py_Type(self))) {
 		Py_INCREF(self);
 		return self;
 	}
@@ -4037,9 +4026,9 @@
 	PyObject *val, *name, *args, *result;
 	static PyObject *format;
 
-	if (self->ob_type->tp_base != &Simple_Type) {
+	if (Py_Type(self)->tp_base != &Simple_Type) {
 		return PyUnicode_FromFormat("<%s object at %p>",
-					   self->ob_type->tp_name, self);
+					   Py_Type(self)->tp_name, self);
 	}
 
 	if (format == NULL) {
@@ -4070,8 +4059,7 @@
 }
 
 static PyTypeObject Simple_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes._SimpleCData",
 	sizeof(CDataObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -4224,7 +4212,7 @@
 		PyErr_Format(PyExc_TypeError,
 			     "expected %s instead of %s",
 			     ((PyTypeObject *)(stgdict->proto))->tp_name,
-			     value->ob_type->tp_name);
+			     Py_Type(value)->tp_name);
 		return -1;
 	}
 
@@ -4352,8 +4340,7 @@
 };
 
 PyTypeObject Pointer_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes._Pointer",
 	sizeof(CDataObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -4531,7 +4518,7 @@
 		     "cast() argument 2 must be a pointer type, not %s",
 		     PyType_Check(arg)
 		     ? ((PyTypeObject *)arg)->tp_name
-		     : arg->ob_type->tp_name);
+		     : Py_Type(arg)->tp_name);
 	return 0;
 }
 
@@ -4658,37 +4645,37 @@
 	if (PyType_Ready(&CData_Type) < 0)
 		return;
 
-	Struct_Type.ob_type = &StructType_Type;
+	Py_Type(&Struct_Type) = &StructType_Type;
 	Struct_Type.tp_base = &CData_Type;
 	if (PyType_Ready(&Struct_Type) < 0)
 		return;
 	PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
 
-	Union_Type.ob_type = &UnionType_Type;
+	Py_Type(&Union_Type) = &UnionType_Type;
 	Union_Type.tp_base = &CData_Type;
 	if (PyType_Ready(&Union_Type) < 0)
 		return;
 	PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
 
-	Pointer_Type.ob_type = &PointerType_Type;
+	Py_Type(&Pointer_Type) = &PointerType_Type;
 	Pointer_Type.tp_base = &CData_Type;
 	if (PyType_Ready(&Pointer_Type) < 0)
 		return;
 	PyModule_AddObject(m, "_Pointer", (PyObject *)&Pointer_Type);
 
-	Array_Type.ob_type = &ArrayType_Type;
+	Py_Type(&Array_Type) = &ArrayType_Type;
 	Array_Type.tp_base = &CData_Type;
 	if (PyType_Ready(&Array_Type) < 0)
 		return;
 	PyModule_AddObject(m, "Array", (PyObject *)&Array_Type);
 
-	Simple_Type.ob_type = &SimpleType_Type;
+	Py_Type(&Simple_Type) = &SimpleType_Type;
 	Simple_Type.tp_base = &CData_Type;
 	if (PyType_Ready(&Simple_Type) < 0)
 		return;
 	PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
 
-	CFuncPtr_Type.ob_type = &CFuncPtrType_Type;
+	Py_Type(&CFuncPtr_Type) = &CFuncPtrType_Type;
 	CFuncPtr_Type.tp_base = &CData_Type;
 	if (PyType_Ready(&CFuncPtr_Type) < 0)
 		return;

Modified: python/branches/py3k-struni/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/py3k-struni/Modules/_ctypes/callproc.c	(original)
+++ python/branches/py3k-struni/Modules/_ctypes/callproc.c	Sat Jul 21 19:22:18 2007
@@ -376,8 +376,7 @@
 };
 
 PyTypeObject PyCArg_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"CArgObject",
 	sizeof(PyCArgObject),
 	0,
@@ -1169,7 +1168,7 @@
 	if (!CDataObject_Check(pcom) || (pcom->b_size != sizeof(void *))) {
 		PyErr_Format(PyExc_TypeError,
 			     "COM Pointer expected instead of %s instance",
-			     pcom->ob_type->tp_name);
+			     Py_Type(pcom)->tp_name);
 		return NULL;
 	}
 
@@ -1409,7 +1408,7 @@
 	if (!CDataObject_Check(obj)) {
 		PyErr_Format(PyExc_TypeError,
 			     "byref() argument must be a ctypes instance, not '%s'",
-			     obj->ob_type->tp_name);
+			     Py_Type(obj)->tp_name);
 		return NULL;
 	}
 

Modified: python/branches/py3k-struni/Modules/_ctypes/cfield.c
==============================================================================
--- python/branches/py3k-struni/Modules/_ctypes/cfield.c	(original)
+++ python/branches/py3k-struni/Modules/_ctypes/cfield.c	Sat Jul 21 19:22:18 2007
@@ -274,8 +274,7 @@
 }
 
 PyTypeObject CField_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_ctypes.CField",				/* tp_name */
 	sizeof(CFieldObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_ctypes/stgdict.c
==============================================================================
--- python/branches/py3k-struni/Modules/_ctypes/stgdict.c	(original)
+++ python/branches/py3k-struni/Modules/_ctypes/stgdict.c	Sat Jul 21 19:22:18 2007
@@ -79,8 +79,7 @@
 }
 
 PyTypeObject StgDict_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"StgDict",
 	sizeof(StgDictObject),
 	0,
@@ -184,7 +183,7 @@
 			Py_DECREF(fieldlist);
 			return -1;
 		}
-		if (fdescr->ob_type != &CField_Type) {
+		if (Py_Type(fdescr) != &CField_Type) {
 			PyErr_SetString(PyExc_TypeError, "unexpected type");
 			Py_DECREF(fdescr);
 			Py_DECREF(fieldlist);
@@ -207,7 +206,7 @@
 			Py_DECREF(fieldlist);
 			return -1;
 		}
-		assert(new_descr->ob_type == &CField_Type);
+		assert(Py_Type(new_descr) == &CField_Type);
  		new_descr->size = fdescr->size;
  		new_descr->offset = fdescr->offset + offset;
  		new_descr->index = fdescr->index + index;
@@ -255,7 +254,7 @@
 			Py_DECREF(anon_names);
 			return -1;
 		}
-		assert(descr->ob_type == &CField_Type);
+		assert(Py_Type(descr) == &CField_Type);
 		descr->anonymous = 1;
 
 		/* descr is in the field descriptor. */

Modified: python/branches/py3k-struni/Modules/_curses_panel.c
==============================================================================
--- python/branches/py3k-struni/Modules/_curses_panel.c	(original)
+++ python/branches/py3k-struni/Modules/_curses_panel.c	Sat Jul 21 19:22:18 2007
@@ -56,7 +56,7 @@
 
 PyTypeObject PyCursesPanel_Type;
 
-#define PyCursesPanel_Check(v)	 ((v)->ob_type == &PyCursesPanel_Type)
+#define PyCursesPanel_Check(v)	 (Py_Type(v) == &PyCursesPanel_Type)
 
 /* Some helper functions. The problem is that there's always a window
    associated with a panel. To ensure that Python's GC doesn't pull
@@ -338,8 +338,7 @@
 /* -------------------------------------------------------*/
 
 PyTypeObject PyCursesPanel_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,			/*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_curses_panel.curses panel",	/*tp_name*/
     sizeof(PyCursesPanelObject),	/*tp_basicsize*/
     0,			/*tp_itemsize*/
@@ -458,7 +457,7 @@
     PyObject *m, *d, *v;
 
     /* Initialize object type */
-    PyCursesPanel_Type.ob_type = &PyType_Type;
+    Py_Type(&PyCursesPanel_Type) = &PyType_Type;
 
     import_curses();
 

Modified: python/branches/py3k-struni/Modules/_cursesmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/_cursesmodule.c	(original)
+++ python/branches/py3k-struni/Modules/_cursesmodule.c	Sat Jul 21 19:22:18 2007
@@ -1567,8 +1567,7 @@
 /* -------------------------------------------------------*/
 
 PyTypeObject PyCursesWindow_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_curses.curses window",	/*tp_name*/
 	sizeof(PyCursesWindowObject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -2660,7 +2659,7 @@
 	static void *PyCurses_API[PyCurses_API_pointers];
 
 	/* Initialize object type */
-	PyCursesWindow_Type.ob_type = &PyType_Type;
+	Py_Type(&PyCursesWindow_Type) = &PyType_Type;
 
 	/* Initialize the C API pointer array */
 	PyCurses_API[0] = (void *)&PyCursesWindow_Type;

Modified: python/branches/py3k-struni/Modules/_elementtree.c
==============================================================================
--- python/branches/py3k-struni/Modules/_elementtree.c	(original)
+++ python/branches/py3k-struni/Modules/_elementtree.c	Sat Jul 21 19:22:18 2007
@@ -248,7 +248,7 @@
 
 static PyTypeObject Element_Type;
 
-#define Element_CheckExact(op) ((op)->ob_type == &Element_Type)
+#define Element_CheckExact(op) (Py_Type(op) == &Element_Type)
 
 /* -------------------------------------------------------------------- */
 /* element constructor and destructor */
@@ -1174,7 +1174,7 @@
         /* FIXME: support arbitrary sequences? */
         PyErr_Format(
             PyExc_TypeError,
-            "expected list, not \"%.200s\"", item->ob_type->tp_name
+            "expected list, not \"%.200s\"", Py_Type(item)->tp_name
             );
         return -1;
     }
@@ -1367,8 +1367,8 @@
 };
 
 static PyTypeObject Element_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0, "Element", sizeof(ElementObject), 0,
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "Element", sizeof(ElementObject), 0,
     /* methods */
     (destructor)element_dealloc, /* tp_dealloc */
     0, /* tp_print */
@@ -1407,7 +1407,7 @@
 
 static PyTypeObject TreeBuilder_Type;
 
-#define TreeBuilder_CheckExact(op) ((op)->ob_type == &TreeBuilder_Type)
+#define TreeBuilder_CheckExact(op) (Py_Type(op) == &TreeBuilder_Type)
 
 /* -------------------------------------------------------------------- */
 /* constructor and destructor */
@@ -1574,7 +1574,7 @@
         Py_INCREF(data); self->data = data;
     } else {
         /* more than one item; use a list to collect items */
-        if (PyString_CheckExact(self->data) && self->data->ob_refcnt == 1 &&
+        if (PyString_CheckExact(self->data) && Py_Refcnt(self->data) == 1 &&
             PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) {
             /* expat often generates single character data sections; handle
                the most common case by resizing the existing string... */
@@ -1780,8 +1780,8 @@
 }
 
 static PyTypeObject TreeBuilder_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0, "TreeBuilder", sizeof(TreeBuilderObject), 0,
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "TreeBuilder", sizeof(TreeBuilderObject), 0,
     /* methods */
     (destructor)treebuilder_dealloc, /* tp_dealloc */
     0, /* tp_print */
@@ -2545,8 +2545,8 @@
 }
 
 static PyTypeObject XMLParser_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0, "XMLParser", sizeof(XMLParserObject), 0,
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "XMLParser", sizeof(XMLParserObject), 0,
     /* methods */
     (destructor)xmlparser_dealloc, /* tp_dealloc */
     0, /* tp_print */
@@ -2580,9 +2580,9 @@
 #endif
 
     /* Patch object type */
-    Element_Type.ob_type = TreeBuilder_Type.ob_type = &PyType_Type;
+    Py_Type(&Element_Type) = Py_Type(&TreeBuilder_Type) = &PyType_Type;
 #if defined(USE_EXPAT)
-    XMLParser_Type.ob_type = &PyType_Type;
+    Py_Type(&XMLParser_Type) = &PyType_Type;
 #endif
 
     m = Py_InitModule("_elementtree", _functions);

Modified: python/branches/py3k-struni/Modules/_fileio.c
==============================================================================
--- python/branches/py3k-struni/Modules/_fileio.c	(original)
+++ python/branches/py3k-struni/Modules/_fileio.c	Sat Jul 21 19:22:18 2007
@@ -281,7 +281,7 @@
 			Py_DECREF(closeresult);
 	}
 
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static PyObject *
@@ -820,8 +820,7 @@
 };
 
 PyTypeObject PyFileIO_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"FileIO",
 	sizeof(PyFileIOObject),
 	0,

Modified: python/branches/py3k-struni/Modules/_functoolsmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/_functoolsmodule.c	(original)
+++ python/branches/py3k-struni/Modules/_functoolsmodule.c	Sat Jul 21 19:22:18 2007
@@ -81,7 +81,7 @@
 	Py_XDECREF(pto->args);
 	Py_XDECREF(pto->kw);
 	Py_XDECREF(pto->dict);
-	pto->ob_type->tp_free(pto);
+	Py_Type(pto)->tp_free(pto);
 }
 
 static PyObject *
@@ -197,8 +197,7 @@
 };
 
 static PyTypeObject partial_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"functools.partial",		/* tp_name */
 	sizeof(partialobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_hashopenssl.c
==============================================================================
--- python/branches/py3k-struni/Modules/_hashopenssl.c	(original)
+++ python/branches/py3k-struni/Modules/_hashopenssl.c	Sat Jul 21 19:22:18 2007
@@ -276,8 +276,7 @@
 digest_size -- number of bytes in this hashes output\n");
 
 static PyTypeObject EVPtype = {
-    PyObject_HEAD_INIT(NULL)
-    0,			/*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_hashlib.HASH",    /*tp_name*/
     sizeof(EVPobject),	/*tp_basicsize*/
     0,			/*tp_itemsize*/
@@ -459,7 +458,7 @@
      * but having some be unsupported.  Only init appropriate
      * constants. */
 
-    EVPtype.ob_type = &PyType_Type;
+    Py_Type(&EVPtype) = &PyType_Type;
     if (PyType_Ready(&EVPtype) < 0)
         return;
 

Modified: python/branches/py3k-struni/Modules/_hotshot.c
==============================================================================
--- python/branches/py3k-struni/Modules/_hotshot.c	(original)
+++ python/branches/py3k-struni/Modules/_hotshot.c	Sat Jul 21 19:22:18 2007
@@ -1220,8 +1220,7 @@
 "linetimings:  True if line events collect timing information.");
 
 static PyTypeObject ProfilerType = {
-    PyObject_HEAD_INIT(NULL)
-    0,					/* ob_size		*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_hotshot.ProfilerType",		/* tp_name		*/
     (int) sizeof(ProfilerObject),	/* tp_basicsize		*/
     0,					/* tp_itemsize		*/
@@ -1305,8 +1304,7 @@
 };
 
 static PyTypeObject LogReaderType = {
-    PyObject_HEAD_INIT(NULL)
-    0,					/* ob_size		*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_hotshot.LogReaderType",		/* tp_name		*/
     (int) sizeof(LogReaderObject),	/* tp_basicsize		*/
     0,					/* tp_itemsize		*/
@@ -1613,8 +1611,8 @@
 {
     PyObject *module;
 
-    LogReaderType.ob_type = &PyType_Type;
-    ProfilerType.ob_type = &PyType_Type;
+    Py_Type(&LogReaderType) = &PyType_Type;
+    Py_Type(&ProfilerType) = &PyType_Type;
     module = Py_InitModule("_hotshot", functions);
     if (module != NULL) {
         char *s = get_version_string();

Modified: python/branches/py3k-struni/Modules/_lsprof.c
==============================================================================
--- python/branches/py3k-struni/Modules/_lsprof.c	(original)
+++ python/branches/py3k-struni/Modules/_lsprof.c	Sat Jul 21 19:22:18 2007
@@ -120,7 +120,7 @@
 static PyTypeObject PyProfiler_Type;
 
 #define PyProfiler_Check(op) PyObject_TypeCheck(op, &PyProfiler_Type)
-#define PyProfiler_CheckExact(op) ((op)->ob_type == &PyProfiler_Type)
+#define PyProfiler_CheckExact(op) (Py_Type(op) == &PyProfiler_Type)
 
 /*** External Timers ***/
 
@@ -210,7 +210,7 @@
 		PyObject *self = fn->m_self;
 		PyObject *name = PyString_FromString(fn->m_ml->ml_name);
 		if (name != NULL) {
-			PyObject *mo = _PyType_Lookup(self->ob_type, name);
+			PyObject *mo = _PyType_Lookup(Py_Type(self), name);
 			Py_XINCREF(mo);
 			Py_DECREF(name);
 			if (mo != NULL) {
@@ -747,7 +747,7 @@
 	flush_unmatched(op);
 	clearEntries(op);
 	Py_XDECREF(op->externalTimer);
-	op->ob_type->tp_free(op);
+	Py_Type(op)->tp_free(op);
 }
 
 static int
@@ -803,8 +803,7 @@
 ");
 
 static PyTypeObject PyProfiler_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,                                      /* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_lsprof.Profiler",                     /* tp_name */
 	sizeof(ProfilerObject),                 /* tp_basicsize */
 	0,                                      /* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_randommodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/_randommodule.c	(original)
+++ python/branches/py3k-struni/Modules/_randommodule.c	Sat Jul 21 19:22:18 2007
@@ -84,7 +84,7 @@
 
 static PyTypeObject Random_Type;
 
-#define RandomObject_Check(v)	   ((v)->ob_type == &Random_Type)
+#define RandomObject_Check(v)	   (Py_Type(v) == &Random_Type)
 
 
 /* Random methods */
@@ -404,7 +404,7 @@
 	if (!PyInt_Check(n) && !PyLong_Check(n)) {
 		PyErr_Format(PyExc_TypeError, "jumpahead requires an "
 			     "integer, not '%s'",
-			     n->ob_type->tp_name);
+			     Py_Type(n)->tp_name);
 		return NULL;
 	}
 
@@ -518,8 +518,7 @@
 "Random() -> create a random number generator with its own internal state.");
 
 static PyTypeObject Random_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_random.Random",		/*tp_name*/
 	sizeof(RandomObject),		/*tp_basicsize*/
 	0,				/*tp_itemsize*/

Modified: python/branches/py3k-struni/Modules/_sqlite/cache.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sqlite/cache.c	(original)
+++ python/branches/py3k-struni/Modules/_sqlite/cache.c	Sat Jul 21 19:22:18 2007
@@ -51,7 +51,7 @@
     Py_DECREF(self->key);
     Py_DECREF(self->data);
 
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 int pysqlite_cache_init(pysqlite_Cache* self, PyObject* args, PyObject* kwargs)
@@ -109,7 +109,7 @@
     }
     Py_DECREF(self->mapping);
 
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
@@ -274,8 +274,7 @@
 };
 
 PyTypeObject pysqlite_NodeType = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME "Node",                             /* tp_name */
         sizeof(pysqlite_Node),                          /* tp_basicsize */
         0,                                              /* tp_itemsize */
@@ -317,8 +316,7 @@
 };
 
 PyTypeObject pysqlite_CacheType = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME ".Cache",                           /* tp_name */
         sizeof(pysqlite_Cache),                         /* tp_basicsize */
         0,                                              /* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_sqlite/connection.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sqlite/connection.c	(original)
+++ python/branches/py3k-struni/Modules/_sqlite/connection.c	Sat Jul 21 19:22:18 2007
@@ -205,7 +205,7 @@
     Py_XDECREF(self->collations);
     Py_XDECREF(self->statements);
 
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
@@ -1206,8 +1206,7 @@
 };
 
 PyTypeObject pysqlite_ConnectionType = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME ".Connection",                      /* tp_name */
         sizeof(pysqlite_Connection),                    /* tp_basicsize */
         0,                                              /* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_sqlite/cursor.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sqlite/cursor.c	(original)
+++ python/branches/py3k-struni/Modules/_sqlite/cursor.c	Sat Jul 21 19:22:18 2007
@@ -134,7 +134,7 @@
     Py_XDECREF(self->row_factory);
     Py_XDECREF(self->next_row);
 
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 PyObject* _pysqlite_get_converter(PyObject* key)
@@ -1011,8 +1011,7 @@
 PyDoc_STR("SQLite database cursor class.");
 
 PyTypeObject pysqlite_CursorType = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME ".Cursor",                          /* tp_name */
         sizeof(pysqlite_Cursor),                        /* tp_basicsize */
         0,                                              /* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_sqlite/prepare_protocol.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sqlite/prepare_protocol.c	(original)
+++ python/branches/py3k-struni/Modules/_sqlite/prepare_protocol.c	Sat Jul 21 19:22:18 2007
@@ -30,12 +30,11 @@
 
 void pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol* self)
 {
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 PyTypeObject pysqlite_PrepareProtocolType= {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME ".PrepareProtocol",                 /* tp_name */
         sizeof(pysqlite_PrepareProtocol),               /* tp_basicsize */
         0,                                              /* tp_itemsize */
@@ -79,6 +78,6 @@
 extern int pysqlite_prepare_protocol_setup_types(void)
 {
     pysqlite_PrepareProtocolType.tp_new = PyType_GenericNew;
-    pysqlite_PrepareProtocolType.ob_type= &PyType_Type;
+    Py_Type(&pysqlite_PrepareProtocolType)= &PyType_Type;
     return PyType_Ready(&pysqlite_PrepareProtocolType);
 }

Modified: python/branches/py3k-struni/Modules/_sqlite/row.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sqlite/row.c	(original)
+++ python/branches/py3k-struni/Modules/_sqlite/row.c	Sat Jul 21 19:22:18 2007
@@ -30,7 +30,7 @@
     Py_XDECREF(self->data);
     Py_XDECREF(self->description);
 
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 int pysqlite_row_init(pysqlite_Row* self, PyObject* args, PyObject* kwargs)
@@ -183,8 +183,7 @@
 
 
 PyTypeObject pysqlite_RowType = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME ".Row",                             /* tp_name */
         sizeof(pysqlite_Row),                           /* tp_basicsize */
         0,                                              /* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_sqlite/statement.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sqlite/statement.c	(original)
+++ python/branches/py3k-struni/Modules/_sqlite/statement.c	Sat Jul 21 19:22:18 2007
@@ -303,7 +303,7 @@
         PyObject_ClearWeakRefs((PyObject*)self);
     }
 
-    self->ob_type->tp_free((PyObject*)self);
+    Py_Type(self)->tp_free((PyObject*)self);
 }
 
 /*
@@ -377,8 +377,7 @@
 }
 
 PyTypeObject pysqlite_StatementType = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                              /* ob_size */
+        PyVarObject_HEAD_INIT(NULL, 0)
         MODULE_NAME ".Statement",                       /* tp_name */
         sizeof(pysqlite_Statement),                     /* tp_basicsize */
         0,                                              /* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_sre.c
==============================================================================
--- python/branches/py3k-struni/Modules/_sre.c	(original)
+++ python/branches/py3k-struni/Modules/_sre.c	Sat Jul 21 19:22:18 2007
@@ -1685,7 +1685,7 @@
 #endif
 
     /* get pointer to string buffer */
-    buffer = string->ob_type->tp_as_buffer;
+    buffer = Py_Type(string)->tp_as_buffer;
     if (!buffer || !buffer->bf_getreadbuffer || !buffer->bf_getsegcount ||
         buffer->bf_getsegcount(string, NULL) != 1) {
         PyErr_SetString(PyExc_TypeError, "expected string or buffer");
@@ -2629,8 +2629,8 @@
 }
 
 static PyTypeObject Pattern_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0, "_" SRE_MODULE ".SRE_Pattern",
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "_" SRE_MODULE ".SRE_Pattern",
     sizeof(PatternObject), sizeof(SRE_CODE),
     (destructor)pattern_dealloc, /*tp_dealloc*/
     0, /*tp_print*/
@@ -3164,8 +3164,8 @@
    detach the associated string, if any */
 
 static PyTypeObject Match_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0, "_" SRE_MODULE ".SRE_Match",
+    PyVarObject_HEAD_INIT(NULL,0)
+    "_" SRE_MODULE ".SRE_Match",
     sizeof(MatchObject), sizeof(Py_ssize_t),
     (destructor)match_dealloc, /*tp_dealloc*/
     0, /*tp_print*/
@@ -3339,8 +3339,8 @@
 }
 
 static PyTypeObject Scanner_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0, "_" SRE_MODULE ".SRE_Scanner",
+    PyVarObject_HEAD_INIT(NULL, 0)
+    "_" SRE_MODULE ".SRE_Scanner",
     sizeof(ScannerObject), 0,
     (destructor)scanner_dealloc, /*tp_dealloc*/
     0, /*tp_print*/

Modified: python/branches/py3k-struni/Modules/_ssl.c
==============================================================================
--- python/branches/py3k-struni/Modules/_ssl.c	(original)
+++ python/branches/py3k-struni/Modules/_ssl.c	Sat Jul 21 19:22:18 2007
@@ -72,7 +72,7 @@
 static int check_socket_and_wait_for_timeout(PySocketSockObject *s, 
 					     int writing);
 
-#define PySSLObject_Check(v)	((v)->ob_type == &PySSL_Type)
+#define PySSLObject_Check(v)	(Py_Type(v) == &PySSL_Type)
 
 typedef enum {
 	SOCKET_IS_NONBLOCKING,
@@ -570,8 +570,7 @@
 }
 
 static PyTypeObject PySSL_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"socket.SSL",			/*tp_name*/
 	sizeof(PySSLObject),		/*tp_basicsize*/
 	0,				/*tp_itemsize*/
@@ -632,7 +631,7 @@
     if (!PyString_Check(arg))
 	return PyErr_Format(PyExc_TypeError,
 			    "RAND_egd() expected string, found %s",
-			    arg->ob_type->tp_name);
+			    Py_Type(arg)->tp_name);
     bytes = RAND_egd(PyString_AS_STRING(arg));
     if (bytes == -1) {
 	PyErr_SetString(PySSLErrorObject,
@@ -678,7 +677,7 @@
 {
 	PyObject *m, *d;
 
-	PySSL_Type.ob_type = &PyType_Type;
+	Py_Type(&PySSL_Type) = &PyType_Type;
 
 	m = Py_InitModule3("_ssl", PySSL_methods, module_doc);
 	if (m == NULL)

Modified: python/branches/py3k-struni/Modules/_struct.c
==============================================================================
--- python/branches/py3k-struni/Modules/_struct.c	(original)
+++ python/branches/py3k-struni/Modules/_struct.c	Sat Jul 21 19:22:18 2007
@@ -72,7 +72,7 @@
 
 
 #define PyStruct_Check(op) PyObject_TypeCheck(op, &PyStructType)
-#define PyStruct_CheckExact(op) ((op)->ob_type == &PyStructType)
+#define PyStruct_CheckExact(op) (Py_Type(op) == &PyStructType)
 
 
 /* Exception */
@@ -131,7 +131,7 @@
 		Py_INCREF(v);
 		return v;
 	}
-	m = v->ob_type->tp_as_number;
+	m = Py_Type(v)->tp_as_number;
 	if (m != NULL && m->nb_long != NULL) {
 		v = m->nb_long(v);
 		if (v == NULL)
@@ -1490,7 +1490,7 @@
 		PyMem_FREE(s->s_codes);
 	}
 	Py_XDECREF(s->s_format);
-	s->ob_type->tp_free((PyObject *)s);
+	Py_Type(s)->tp_free((PyObject *)s);
 }
 
 static PyObject *
@@ -1839,8 +1839,7 @@
 
 static
 PyTypeObject PyStructType = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"Struct",
 	sizeof(PyStructObject),
 	0,
@@ -1890,7 +1889,7 @@
 	if (m == NULL)
 		return;
 
-	PyStructType.ob_type = &PyType_Type;
+	Py_Type(&PyStructType) = &PyType_Type;
 	if (PyType_Ready(&PyStructType) < 0)
 		return;
 

Modified: python/branches/py3k-struni/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k-struni/Modules/_testcapimodule.c	Sat Jul 21 19:22:18 2007
@@ -951,8 +951,7 @@
 }
 
 static PyTypeObject test_structmembersType = {
-    PyObject_HEAD_INIT(NULL)
-    0,
+    PyVarObject_HEAD_INIT(NULL, 0)
 	"test_structmembersType",
 	sizeof(test_structmembers),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1002,7 +1001,7 @@
 	if (m == NULL)
 		return;
 
-	test_structmembersType.ob_type=&PyType_Type;
+	Py_Type(&test_structmembersType)=&PyType_Type;
 	Py_INCREF(&test_structmembersType);
 	PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType);
 

Modified: python/branches/py3k-struni/Modules/_tkinter.c
==============================================================================
--- python/branches/py3k-struni/Modules/_tkinter.c	(original)
+++ python/branches/py3k-struni/Modules/_tkinter.c	Sat Jul 21 19:22:18 2007
@@ -262,12 +262,12 @@
 	Tcl_ObjType *StringType;
 } TkappObject;
 
-#define Tkapp_Check(v) ((v)->ob_type == &Tkapp_Type)
+#define Tkapp_Check(v) (Py_Type(v) == &Tkapp_Type)
 #define Tkapp_Interp(v) (((TkappObject *) (v))->interp)
 #define Tkapp_Result(v) Tcl_GetStringResult(Tkapp_Interp(v))
 
 #define DEBUG_REFCNT(v) (printf("DEBUG: id=%p, refcnt=%i\n", \
-(void *) v, ((PyObject *) v)->ob_refcnt))
+(void *) v, Py_Refcnt(v)))
 
 
 
@@ -828,8 +828,7 @@
 };
 
 static PyTypeObject PyTclObject_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_tkinter.Tcl_Obj",		/*tp_name*/
 	sizeof(PyTclObject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -2371,8 +2370,7 @@
 
 static PyTypeObject Tktt_Type =
 {
-	PyObject_HEAD_INIT(NULL)
-	0,				     /*ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"tktimertoken",			     /*tp_name */
 	sizeof(TkttObject),		     /*tp_basicsize */
 	0,				     /*tp_itemsize */
@@ -2716,8 +2714,7 @@
 
 static PyTypeObject Tkapp_Type =
 {
-	PyObject_HEAD_INIT(NULL)
-	0,				     /*ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"tkapp",			     /*tp_name */
 	sizeof(TkappObject),		     /*tp_basicsize */
 	0,				     /*tp_itemsize */
@@ -3056,7 +3053,7 @@
 {
 	PyObject *m, *d;
 
-	Tkapp_Type.ob_type = &PyType_Type;
+	Py_Type(&Tkapp_Type) = &PyType_Type;
 
 #ifdef WITH_THREAD
 	tcl_lock = PyThread_allocate_lock();
@@ -3084,10 +3081,10 @@
 
 	PyDict_SetItemString(d, "TkappType", (PyObject *)&Tkapp_Type);
 
-	Tktt_Type.ob_type = &PyType_Type;
+	Py_Type(&Tktt_Type) = &PyType_Type;
 	PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
 
-	PyTclObject_Type.ob_type = &PyType_Type;
+	Py_Type(&PyTclObject_Type) = &PyType_Type;
 	PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
 
 #ifdef TK_AQUA

Modified: python/branches/py3k-struni/Modules/_typesmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/_typesmodule.c	(original)
+++ python/branches/py3k-struni/Modules/_typesmodule.c	Sat Jul 21 19:22:18 2007
@@ -33,8 +33,7 @@
 };
 
 static PyTypeObject HelperType = {
-    PyObject_HEAD_INIT(NULL)
-    0,						/* ob_size */
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_types.Helper",				/* tp_name */
     sizeof(Helper),                             /* tp_basicsize */
     0,						/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/_weakref.c
==============================================================================
--- python/branches/py3k-struni/Modules/_weakref.c	(original)
+++ python/branches/py3k-struni/Modules/_weakref.c	Sat Jul 21 19:22:18 2007
@@ -14,7 +14,7 @@
 {
     PyObject *result = NULL;
 
-    if (PyType_SUPPORTS_WEAKREFS(object->ob_type)) {
+    if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) {
         PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
 
         result = PyInt_FromSsize_t(_PyWeakref_GetWeakrefCount(*list));
@@ -35,7 +35,7 @@
 {
     PyObject *result = NULL;
 
-    if (PyType_SUPPORTS_WEAKREFS(object->ob_type)) {
+    if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) {
         PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
         Py_ssize_t count = _PyWeakref_GetWeakrefCount(*list);
 

Modified: python/branches/py3k-struni/Modules/arraymodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/arraymodule.c	(original)
+++ python/branches/py3k-struni/Modules/arraymodule.c	Sat Jul 21 19:22:18 2007
@@ -39,7 +39,7 @@
 static PyTypeObject Arraytype;
 
 #define array_Check(op) PyObject_TypeCheck(op, &Arraytype)
-#define array_CheckExact(op) ((op)->ob_type == &Arraytype)
+#define array_CheckExact(op) (Py_Type(op) == &Arraytype)
 
 static int
 array_resize(arrayobject *self, Py_ssize_t newsize)
@@ -53,9 +53,9 @@
 	*/
 
 	if (self->allocated >= newsize &&
-	    self->ob_size < newsize + 16 &&
+	    Py_Size(self) < newsize + 16 &&
 	    self->ob_item != NULL) {
-		self->ob_size = newsize;
+		Py_Size(self) = newsize;
 		return 0;
 	}
 
@@ -71,7 +71,7 @@
 	 * memory critical.
 	 */
 
-	_new_size = (newsize >> 4) + (self->ob_size < 8 ? 3 : 7) + newsize;
+	_new_size = (newsize >> 4) + (Py_Size(self) < 8 ? 3 : 7) + newsize;
 	items = self->ob_item;
 	/* XXX The following multiplication and division does not optimize away 
 	   like it does for lists since the size is not known at compile time */
@@ -84,7 +84,7 @@
 		return -1;
 	}
 	self->ob_item = items;
-	self->ob_size = newsize;
+	Py_Size(self) = newsize;
 	self->allocated = _new_size;
 	return 0;
 }
@@ -410,7 +410,7 @@
 	if (op == NULL) {
 		return NULL;
 	}
-	op->ob_size = size;
+	Py_Size(op) = size;
 	if (size <= 0) {
 		op->ob_item = NULL;
 	}
@@ -433,7 +433,7 @@
 	register arrayobject *ap;
 	assert(array_Check(op));
 	ap = (arrayobject *)op;
-	assert(i>=0 && i<ap->ob_size);
+	assert(i>=0 && i<Py_Size(ap));
 	return (*ap->ob_descr->getitem)(ap, i);
 }
 
@@ -441,7 +441,7 @@
 ins1(arrayobject *self, Py_ssize_t where, PyObject *v)
 {
 	char *items;
-	Py_ssize_t n = self->ob_size;
+	Py_ssize_t n = Py_Size(self);
 	if (v == NULL) {
 		PyErr_BadInternalCall();
 		return -1;
@@ -476,7 +476,7 @@
 		PyObject_ClearWeakRefs((PyObject *) op);
 	if (op->ob_item != NULL)
 		PyMem_DEL(op->ob_item);
-	op->ob_type->tp_free((PyObject *)op);
+	Py_Type(op)->tp_free((PyObject *)op);
 }
 
 static PyObject *
@@ -496,7 +496,7 @@
 	va = (arrayobject *)v;
 	wa = (arrayobject *)w;
 
-	if (va->ob_size != wa->ob_size && (op == Py_EQ || op == Py_NE)) {
+	if (Py_Size(va) != Py_Size(wa) && (op == Py_EQ || op == Py_NE)) {
 		/* Shortcut: if the lengths differ, the arrays differ */
 		if (op == Py_EQ)
 			res = Py_False;
@@ -508,7 +508,7 @@
 
 	/* Search for the first index where items are different */
 	k = 1;
-	for (i = 0; i < va->ob_size && i < wa->ob_size; i++) {
+	for (i = 0; i < Py_Size(va) && i < Py_Size(wa); i++) {
 		vi = getarrayitem(v, i);
 		wi = getarrayitem(w, i);
 		if (vi == NULL || wi == NULL) {
@@ -527,8 +527,8 @@
 
 	if (k) {
 		/* No more items to compare -- compare sizes */
-		Py_ssize_t vs = va->ob_size;
-		Py_ssize_t ws = wa->ob_size;
+		Py_ssize_t vs = Py_Size(va);
+		Py_ssize_t ws = Py_Size(wa);
 		int cmp;
 		switch (op) {
 		case Py_LT: cmp = vs <  ws; break;
@@ -568,13 +568,13 @@
 static Py_ssize_t
 array_length(arrayobject *a)
 {
-	return a->ob_size;
+	return Py_Size(a);
 }
 
 static PyObject *
 array_item(arrayobject *a, Py_ssize_t i)
 {
-	if (i < 0 || i >= a->ob_size) {
+	if (i < 0 || i >= Py_Size(a)) {
 		PyErr_SetString(PyExc_IndexError, "array index out of range");
 		return NULL;
 	}
@@ -587,14 +587,14 @@
 	arrayobject *np;
 	if (ilow < 0)
 		ilow = 0;
-	else if (ilow > a->ob_size)
-		ilow = a->ob_size;
+	else if (ilow > Py_Size(a))
+		ilow = Py_Size(a);
 	if (ihigh < 0)
 		ihigh = 0;
 	if (ihigh < ilow)
 		ihigh = ilow;
-	else if (ihigh > a->ob_size)
-		ihigh = a->ob_size;
+	else if (ihigh > Py_Size(a))
+		ihigh = Py_Size(a);
 	np = (arrayobject *) newarrayobject(&Arraytype, ihigh - ilow, a->ob_descr);
 	if (np == NULL)
 		return NULL;
@@ -606,7 +606,7 @@
 static PyObject *
 array_copy(arrayobject *a, PyObject *unused)
 {
-	return array_slice(a, 0, a->ob_size);
+	return array_slice(a, 0, Py_Size(a));
 }
 
 PyDoc_STRVAR(copy_doc,
@@ -622,7 +622,7 @@
 	if (!array_Check(bb)) {
 		PyErr_Format(PyExc_TypeError,
 		     "can only append array (not \"%.200s\") to array",
-			     bb->ob_type->tp_name);
+			     Py_Type(bb)->tp_name);
 		return NULL;
 	}
 #define b ((arrayobject *)bb)
@@ -630,14 +630,14 @@
 		PyErr_BadArgument();
 		return NULL;
 	}
-	size = a->ob_size + b->ob_size;
+	size = Py_Size(a) + Py_Size(b);
 	np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr);
 	if (np == NULL) {
 		return NULL;
 	}
-	memcpy(np->ob_item, a->ob_item, a->ob_size*a->ob_descr->itemsize);
-	memcpy(np->ob_item + a->ob_size*a->ob_descr->itemsize,
-	       b->ob_item, b->ob_size*b->ob_descr->itemsize);
+	memcpy(np->ob_item, a->ob_item, Py_Size(a)*a->ob_descr->itemsize);
+	memcpy(np->ob_item + Py_Size(a)*a->ob_descr->itemsize,
+	       b->ob_item, Py_Size(b)*b->ob_descr->itemsize);
 	return (PyObject *)np;
 #undef b
 }
@@ -652,12 +652,12 @@
 	Py_ssize_t nbytes;
 	if (n < 0)
 		n = 0;
-	size = a->ob_size * n;
+	size = Py_Size(a) * n;
 	np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr);
 	if (np == NULL)
 		return NULL;
 	p = np->ob_item;
-	nbytes = a->ob_size * a->ob_descr->itemsize;
+	nbytes = Py_Size(a) * a->ob_descr->itemsize;
 	for (i = 0; i < n; i++) {
 		memcpy(p, a->ob_item, nbytes);
 		p += nbytes;
@@ -675,7 +675,7 @@
 	if (v == NULL)
 		n = 0;
 	else if (array_Check(v)) {
-		n = b->ob_size;
+		n = Py_Size(b);
 		if (a == b) {
 			/* Special case "a[i:j] = a" -- copy b first */
 			int ret;
@@ -694,44 +694,44 @@
 	else {
 		PyErr_Format(PyExc_TypeError,
 	     "can only assign array (not \"%.200s\") to array slice",
-			     v->ob_type->tp_name);
+			     Py_Type(v)->tp_name);
 		return -1;
 	}
 	if (ilow < 0)
 		ilow = 0;
-	else if (ilow > a->ob_size)
-		ilow = a->ob_size;
+	else if (ilow > Py_Size(a))
+		ilow = Py_Size(a);
 	if (ihigh < 0)
 		ihigh = 0;
 	if (ihigh < ilow)
 		ihigh = ilow;
-	else if (ihigh > a->ob_size)
-		ihigh = a->ob_size;
+	else if (ihigh > Py_Size(a))
+		ihigh = Py_Size(a);
 	item = a->ob_item;
 	d = n - (ihigh-ilow);
 	if (d < 0) { /* Delete -d items */
 		memmove(item + (ihigh+d)*a->ob_descr->itemsize,
 			item + ihigh*a->ob_descr->itemsize,
-			(a->ob_size-ihigh)*a->ob_descr->itemsize);
-		a->ob_size += d;
-		PyMem_RESIZE(item, char, a->ob_size*a->ob_descr->itemsize);
+			(Py_Size(a)-ihigh)*a->ob_descr->itemsize);
+		Py_Size(a) += d;
+		PyMem_RESIZE(item, char, Py_Size(a)*a->ob_descr->itemsize);
 						/* Can't fail */
 		a->ob_item = item;
-		a->allocated = a->ob_size;
+		a->allocated = Py_Size(a);
 	}
 	else if (d > 0) { /* Insert d items */
 		PyMem_RESIZE(item, char,
-			     (a->ob_size + d)*a->ob_descr->itemsize);
+			     (Py_Size(a) + d)*a->ob_descr->itemsize);
 		if (item == NULL) {
 			PyErr_NoMemory();
 			return -1;
 		}
 		memmove(item + (ihigh+d)*a->ob_descr->itemsize,
 			item + ihigh*a->ob_descr->itemsize,
-			(a->ob_size-ihigh)*a->ob_descr->itemsize);
+			(Py_Size(a)-ihigh)*a->ob_descr->itemsize);
 		a->ob_item = item;
-		a->ob_size += d;
-		a->allocated = a->ob_size;
+		Py_Size(a) += d;
+		a->allocated = Py_Size(a);
 	}
 	if (n > 0)
 		memcpy(item + ilow*a->ob_descr->itemsize, b->ob_item,
@@ -743,7 +743,7 @@
 static int
 array_ass_item(arrayobject *a, Py_ssize_t i, PyObject *v)
 {
-	if (i < 0 || i >= a->ob_size) {
+	if (i < 0 || i >= Py_Size(a)) {
 		PyErr_SetString(PyExc_IndexError,
 			         "array assignment index out of range");
 		return -1;
@@ -770,7 +770,7 @@
 		return -1;
 
 	while ((v = PyIter_Next(it)) != NULL) {
-		if (ins1(self, (int) self->ob_size, v) != 0) {
+		if (ins1(self, (int) Py_Size(self), v) != 0) {
 			Py_DECREF(v);
 			Py_DECREF(it);
 			return -1;
@@ -796,16 +796,16 @@
 			     "can only extend with array of same kind");
 		return -1;
 	}
-	size = self->ob_size + b->ob_size;
+	size = Py_Size(self) + Py_Size(b);
         PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize);
         if (self->ob_item == NULL) {
                 PyObject_Del(self);
                 PyErr_NoMemory();
 		return -1;
         }
-	memcpy(self->ob_item + self->ob_size*self->ob_descr->itemsize,
-               b->ob_item, b->ob_size*b->ob_descr->itemsize);
-	self->ob_size = size;
+	memcpy(self->ob_item + Py_Size(self)*self->ob_descr->itemsize,
+               b->ob_item, Py_Size(b)*b->ob_descr->itemsize);
+	Py_Size(self) = size;
 	self->allocated = size;
 
 	return 0;
@@ -818,7 +818,7 @@
 	if (!array_Check(bb)) {
 		PyErr_Format(PyExc_TypeError,
 			"can only extend array with array (not \"%.200s\")",
-			bb->ob_type->tp_name);
+			Py_Type(bb)->tp_name);
 		return NULL;
 	}
 	if (array_do_extend(self, bb) == -1)
@@ -833,15 +833,15 @@
 	char *items, *p;
 	Py_ssize_t size, i;
 
-	if (self->ob_size > 0) {
+	if (Py_Size(self) > 0) {
 		if (n < 0)
 			n = 0;
 		items = self->ob_item;
-		size = self->ob_size * self->ob_descr->itemsize;
+		size = Py_Size(self) * self->ob_descr->itemsize;
 		if (n == 0) {
 			PyMem_FREE(items);
 			self->ob_item = NULL;
-			self->ob_size = 0;
+			Py_Size(self) = 0;
 			self->allocated = 0;
 		}
 		else {
@@ -854,8 +854,8 @@
 				memcpy(p, items, size);
 			}
 			self->ob_item = items;
-			self->ob_size *= n;
-			self->allocated = self->ob_size;
+			Py_Size(self) *= n;
+			self->allocated = Py_Size(self);
 		}
 	}
 	Py_INCREF(self);
@@ -878,7 +878,7 @@
 	Py_ssize_t count = 0;
 	Py_ssize_t i;
 
-	for (i = 0; i < self->ob_size; i++) {
+	for (i = 0; i < Py_Size(self); i++) {
 		PyObject *selfi = getarrayitem((PyObject *)self, i);
 		int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
 		Py_DECREF(selfi);
@@ -900,7 +900,7 @@
 {
 	Py_ssize_t i;
 
-	for (i = 0; i < self->ob_size; i++) {
+	for (i = 0; i < Py_Size(self); i++) {
 		PyObject *selfi = getarrayitem((PyObject *)self, i);
 		int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
 		Py_DECREF(selfi);
@@ -925,7 +925,7 @@
 	Py_ssize_t i;
 	int cmp;
 
-	for (i = 0, cmp = 0 ; cmp == 0 && i < self->ob_size; i++) {
+	for (i = 0, cmp = 0 ; cmp == 0 && i < Py_Size(self); i++) {
 		PyObject *selfi = getarrayitem((PyObject *)self, i);
 		cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
 		Py_DECREF(selfi);
@@ -938,7 +938,7 @@
 {
 	int i;
 
-	for (i = 0; i < self->ob_size; i++) {
+	for (i = 0; i < Py_Size(self); i++) {
 		PyObject *selfi = getarrayitem((PyObject *)self,i);
 		int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
 		Py_DECREF(selfi);
@@ -968,14 +968,14 @@
 	PyObject *v;
 	if (!PyArg_ParseTuple(args, "|n:pop", &i))
 		return NULL;
-	if (self->ob_size == 0) {
+	if (Py_Size(self) == 0) {
 		/* Special-case most common failure cause */
 		PyErr_SetString(PyExc_IndexError, "pop from empty array");
 		return NULL;
 	}
 	if (i < 0)
-		i += self->ob_size;
-	if (i < 0 || i >= self->ob_size) {
+		i += Py_Size(self);
+	if (i < 0 || i >= Py_Size(self)) {
 		PyErr_SetString(PyExc_IndexError, "pop index out of range");
 		return NULL;
 	}
@@ -1031,7 +1031,7 @@
 		return NULL;
 
 	PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item));
-	PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(self->ob_size)));
+	PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(Py_Size(self))));
 
 	return retval;
 }
@@ -1048,7 +1048,7 @@
 static PyObject *
 array_append(arrayobject *self, PyObject *v)
 {
-	return ins(self, (int) self->ob_size, v);
+	return ins(self, (int) Py_Size(self), v);
 }
 
 PyDoc_STRVAR(append_doc,
@@ -1067,14 +1067,14 @@
 	case 1:
 		break;
 	case 2:
-		for (p = self->ob_item, i = self->ob_size; --i >= 0; p += 2) {
+		for (p = self->ob_item, i = Py_Size(self); --i >= 0; p += 2) {
 			char p0 = p[0];
 			p[0] = p[1];
 			p[1] = p0;
 		}
 		break;
 	case 4:
-		for (p = self->ob_item, i = self->ob_size; --i >= 0; p += 4) {
+		for (p = self->ob_item, i = Py_Size(self); --i >= 0; p += 4) {
 			char p0 = p[0];
 			char p1 = p[1];
 			p[0] = p[3];
@@ -1084,7 +1084,7 @@
 		}
 		break;
 	case 8:
-		for (p = self->ob_item, i = self->ob_size; --i >= 0; p += 8) {
+		for (p = self->ob_item, i = Py_Size(self); --i >= 0; p += 8) {
 			char p0 = p[0];
 			char p1 = p[1];
 			char p2 = p[2];
@@ -1125,16 +1125,16 @@
 		dict = Py_None;
 		Py_INCREF(dict);
 	}
-	if (array->ob_size > 0) {
+	if (Py_Size(array) > 0) {
 		result = Py_BuildValue("O(cy#)O", 
-			array->ob_type, 
+			Py_Type(array), 
 			array->ob_descr->typecode,
 			array->ob_item,
-			array->ob_size * array->ob_descr->itemsize,
+			Py_Size(array) * array->ob_descr->itemsize,
 			dict);
 	} else {
 		result = Py_BuildValue("O(c)O", 
-			array->ob_type, 
+			Py_Type(array), 
 			array->ob_descr->typecode,
 			dict);
 	}
@@ -1153,9 +1153,9 @@
 	char tmp[256];	/* 8 is probably enough -- but why skimp */
 	assert((size_t)itemsize <= sizeof(tmp));
 
-	if (self->ob_size > 1) {
+	if (Py_Size(self) > 1) {
 		for (p = self->ob_item,
-		     q = self->ob_item + (self->ob_size - 1)*itemsize;
+		     q = self->ob_item + (Py_Size(self) - 1)*itemsize;
 		     p < q;
 		     p += itemsize, q -= itemsize) {
 			/* memory areas guaranteed disjoint, so memcpy
@@ -1242,7 +1242,7 @@
 	Py_ssize_t nblocks = (nbytes + BLOCKSIZE - 1) / BLOCKSIZE;
 	Py_ssize_t i;
 
-        if (self->ob_size == 0)
+        if (Py_Size(self) == 0)
 		goto done;
 
 	for (i = 0; i < nblocks; i++) {
@@ -1286,23 +1286,23 @@
 	if (n > 0) {
 		char *item = self->ob_item;
 		Py_ssize_t i;
-		PyMem_RESIZE(item, char, (self->ob_size + n) * itemsize);
+		PyMem_RESIZE(item, char, (Py_Size(self) + n) * itemsize);
 		if (item == NULL) {
 			PyErr_NoMemory();
 			return NULL;
 		}
 		self->ob_item = item;
-		self->ob_size += n;
-		self->allocated = self->ob_size;
+		Py_Size(self) += n;
+		self->allocated = Py_Size(self);
 		for (i = 0; i < n; i++) {
 			PyObject *v = PyList_GetItem(list, i);
 			if ((*self->ob_descr->setitem)(self,
-					self->ob_size - n + i, v) != 0) {
-				self->ob_size -= n;
+					Py_Size(self) - n + i, v) != 0) {
+				Py_Size(self) -= n;
 				PyMem_RESIZE(item, char,
-					          self->ob_size * itemsize);
+					          Py_Size(self) * itemsize);
 				self->ob_item = item;
-				self->allocated = self->ob_size;
+				self->allocated = Py_Size(self);
 				return NULL;
 			}
 		}
@@ -1319,12 +1319,12 @@
 static PyObject *
 array_tolist(arrayobject *self, PyObject *unused)
 {
-	PyObject *list = PyList_New(self->ob_size);
+	PyObject *list = PyList_New(Py_Size(self));
 	Py_ssize_t i;
 
 	if (list == NULL)
 		return NULL;
-	for (i = 0; i < self->ob_size; i++) {
+	for (i = 0; i < Py_Size(self); i++) {
 		PyObject *v = getarrayitem((PyObject *)self, i);
 		if (v == NULL) {
 			Py_DECREF(list);
@@ -1357,15 +1357,15 @@
 	n = n / itemsize;
 	if (n > 0) {
 		char *item = self->ob_item;
-		PyMem_RESIZE(item, char, (self->ob_size + n) * itemsize);
+		PyMem_RESIZE(item, char, (Py_Size(self) + n) * itemsize);
 		if (item == NULL) {
 			PyErr_NoMemory();
 			return NULL;
 		}
 		self->ob_item = item;
-		self->ob_size += n;
-		self->allocated = self->ob_size;
-		memcpy(item + (self->ob_size - n) * itemsize,
+		Py_Size(self) += n;
+		self->allocated = Py_Size(self);
+		memcpy(item + (Py_Size(self) - n) * itemsize,
 		       str, itemsize*n);
 	}
 	Py_INCREF(Py_None);
@@ -1410,15 +1410,15 @@
 	}
 	if (n > 0) {
 		Py_UNICODE *item = (Py_UNICODE *) self->ob_item;
-		PyMem_RESIZE(item, Py_UNICODE, self->ob_size + n);
+		PyMem_RESIZE(item, Py_UNICODE, Py_Size(self) + n);
 		if (item == NULL) {
 			PyErr_NoMemory();
 			return NULL;
 		}
 		self->ob_item = (char *) item;
-		self->ob_size += n;
-		self->allocated = self->ob_size;
-		memcpy(item + self->ob_size - n,
+		Py_Size(self) += n;
+		self->allocated = Py_Size(self);
+		memcpy(item + Py_Size(self) - n,
 		       ustr, n * sizeof(Py_UNICODE));
 	}
 
@@ -1443,7 +1443,7 @@
 			"tounicode() may only be called on type 'u' arrays");
 		return NULL;
 	}
-	return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, self->ob_size);
+	return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, Py_Size(self));
 }
 
 PyDoc_STRVAR(tounicode_doc,
@@ -1536,7 +1536,7 @@
 	PyObject *s, *v = NULL;
 	Py_ssize_t len;
 
-	len = a->ob_size;
+	len = Py_Size(a);
 	typecode = a->ob_descr->typecode;
 	if (len == 0) {
 		return PyUnicode_FromFormat("array('%c')", typecode);
@@ -1560,7 +1560,7 @@
 			return NULL;
 		}
 		if (i < 0)
-			i += self->ob_size;
+			i += Py_Size(self);
 		return array_item(self, i);
 	}
 	else if (PySlice_Check(item)) {
@@ -1569,7 +1569,7 @@
 		arrayobject* ar;
 		int itemsize = self->ob_descr->itemsize;
 
-		if (PySlice_GetIndicesEx((PySliceObject*)item, self->ob_size,
+		if (PySlice_GetIndicesEx((PySliceObject*)item, Py_Size(self),
 				 &start, &stop, &step, &slicelength) < 0) {
 			return NULL;
 		}
@@ -1608,14 +1608,14 @@
 		if (i==-1 && PyErr_Occurred()) 
 			return -1;
 		if (i < 0)
-			i += self->ob_size;
+			i += Py_Size(self);
 		return array_ass_item(self, i, value);
 	}
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 		int itemsize = self->ob_descr->itemsize;
 
-		if (PySlice_GetIndicesEx((PySliceObject*)item, self->ob_size,
+		if (PySlice_GetIndicesEx((PySliceObject*)item, Py_Size(self),
 				 &start, &stop, &step, &slicelength) < 0) {
 			return -1;
 		}
@@ -1643,17 +1643,17 @@
 					self->ob_item + (cur + 1)*itemsize,
 					(step - 1) * itemsize);
 			}
-			extra = self->ob_size - (cur + 1);
+			extra = Py_Size(self) - (cur + 1);
 			if (extra > 0) {
 				memmove(self->ob_item + (cur - i)*itemsize,
 					self->ob_item + (cur + 1)*itemsize,
 					extra*itemsize);
 			}
 
-			self->ob_size -= slicelength;
+			Py_Size(self) -= slicelength;
 			self->ob_item = (char *)PyMem_REALLOC(self->ob_item,
-							      itemsize*self->ob_size);
-			self->allocated = self->ob_size;
+							      itemsize*Py_Size(self));
+			self->allocated = Py_Size(self);
 
 			return 0;
 		}
@@ -1665,16 +1665,16 @@
 			if (!array_Check(value)) {
 				PyErr_Format(PyExc_TypeError,
 			     "must assign array (not \"%.200s\") to slice",
-					     value->ob_type->tp_name);
+					     Py_Type(value)->tp_name);
 				return -1;
 			}
 
 			av = (arrayobject*)value;
 
-			if (av->ob_size != slicelength) {
+			if (Py_Size(av) != slicelength) {
 				PyErr_Format(PyExc_ValueError,
             "attempt to assign array of size %ld to extended slice of size %ld",
-					     /*XXX*/(long)av->ob_size, /*XXX*/(long)slicelength);
+					     /*XXX*/(long)Py_Size(av), /*XXX*/(long)slicelength);
 				return -1;
 			}
 
@@ -1683,7 +1683,7 @@
 
 			/* protect against a[::-1] = a */
 			if (self == av) { 
-				value = array_slice(av, 0, av->ob_size);
+				value = array_slice(av, 0, Py_Size(av));
 				av = (arrayobject*)value;
 				if (!av)
 					return -1;
@@ -1730,7 +1730,7 @@
 	*ptr = (void *)self->ob_item;
 	if (*ptr == NULL)
 		*ptr = emptybuf;
-	return self->ob_size*self->ob_descr->itemsize;
+	return Py_Size(self)*self->ob_descr->itemsize;
 }
 
 static Py_ssize_t
@@ -1744,14 +1744,14 @@
 	*ptr = (void *)self->ob_item;
 	if (*ptr == NULL)
 		*ptr = emptybuf;
-	return self->ob_size*self->ob_descr->itemsize;
+	return Py_Size(self)*self->ob_descr->itemsize;
 }
 
 static Py_ssize_t
 array_buffer_getsegcount(arrayobject *self, Py_ssize_t *lenp)
 {
 	if ( lenp )
-		*lenp = self->ob_size*self->ob_descr->itemsize;
+		*lenp = Py_Size(self)*self->ob_descr->itemsize;
 	return 1;
 }
 
@@ -1861,9 +1861,9 @@
 						return NULL;
 					}
 					self->ob_item = item;
-					self->ob_size = n / sizeof(Py_UNICODE);
+					Py_Size(self) = n / sizeof(Py_UNICODE);
 					memcpy(item, PyUnicode_AS_DATA(initial), n);
-					self->allocated = self->ob_size;
+					self->allocated = Py_Size(self);
 				}
 			}
 			if (it != NULL) {
@@ -1949,8 +1949,7 @@
 static PyObject *array_iter(arrayobject *ao);
 
 static PyTypeObject Arraytype = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"array.array",
 	sizeof(arrayobject),
 	0,
@@ -2031,7 +2030,7 @@
 arrayiter_next(arrayiterobject *it)
 {
 	assert(PyArrayIter_Check(it));
-	if (it->index < it->ao->ob_size)
+	if (it->index < Py_Size(it->ao))
 		return (*it->getitem)(it->ao, it->index++);
 	return NULL;
 }
@@ -2052,8 +2051,7 @@
 }
 
 static PyTypeObject PyArrayIter_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,                                      /* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"arrayiterator",                        /* tp_name */
 	sizeof(arrayiterobject),                /* tp_basicsize */
 	0,                                      /* tp_itemsize */
@@ -2100,7 +2098,7 @@
 
 	if (PyType_Ready(&Arraytype) < 0)
             return;
-	PyArrayIter_Type.ob_type = &PyType_Type;
+	Py_Type(&PyArrayIter_Type) = &PyType_Type;
 	m = Py_InitModule3("array", a_methods, module_doc);
 	if (m == NULL)
 		return;

Modified: python/branches/py3k-struni/Modules/bz2module.c
==============================================================================
--- python/branches/py3k-struni/Modules/bz2module.c	(original)
+++ python/branches/py3k-struni/Modules/bz2module.c	Sat Jul 21 19:22:18 2007
@@ -41,7 +41,7 @@
 #define MODE_READ_EOF 2
 #define MODE_WRITE    3
 
-#define BZ2FileObject_Check(v)	((v)->ob_type == &BZ2File_Type)
+#define BZ2FileObject_Check(v)	(Py_Type(v) == &BZ2File_Type)
 
 
 #ifdef BZ_CONFIG_ERROR
@@ -1245,7 +1245,7 @@
 	Util_DropReadAhead(self);
 	if (self->rawfp != NULL)
 		fclose(self->rawfp);
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 /* This is a hacked version of Python's fileobject.c:file_getiter(). */
@@ -1298,8 +1298,7 @@
 ");
 
 static PyTypeObject BZ2File_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"bz2.BZ2File",		/*tp_name*/
 	sizeof(BZ2FileObject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -1558,7 +1557,7 @@
 		PyThread_free_lock(self->lock);
 #endif
 	BZ2_bzCompressEnd(&self->bzs);
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 
@@ -1575,8 +1574,7 @@
 ");
 
 static PyTypeObject BZ2Comp_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"bz2.BZ2Compressor",	/*tp_name*/
 	sizeof(BZ2CompObject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -1784,7 +1782,7 @@
 #endif
 	Py_XDECREF(self->unused_data);
 	BZ2_bzDecompressEnd(&self->bzs);
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 
@@ -1800,8 +1798,7 @@
 ");
 
 static PyTypeObject BZ2Decomp_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"bz2.BZ2Decompressor",	/*tp_name*/
 	sizeof(BZ2DecompObject), /*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -2043,9 +2040,9 @@
 {
 	PyObject *m;
 
-	BZ2File_Type.ob_type = &PyType_Type;
-	BZ2Comp_Type.ob_type = &PyType_Type;
-	BZ2Decomp_Type.ob_type = &PyType_Type;
+	Py_Type(&BZ2File_Type) = &PyType_Type;
+	Py_Type(&BZ2Comp_Type) = &PyType_Type;
+	Py_Type(&BZ2Decomp_Type) = &PyType_Type;
 
 	m = Py_InitModule3("bz2", bz2_methods, bz2__doc__);
 	if (m == NULL)

Modified: python/branches/py3k-struni/Modules/cStringIO.c
==============================================================================
--- python/branches/py3k-struni/Modules/cStringIO.c	(original)
+++ python/branches/py3k-struni/Modules/cStringIO.c	Sat Jul 21 19:22:18 2007
@@ -506,8 +506,7 @@
 PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings.");
 
 static PyTypeObject Otype = {
-  PyObject_HEAD_INIT(NULL)
-  0,	       			/*ob_size*/
+  PyVarObject_HEAD_INIT(NULL, 0)
   "cStringIO.StringO",   	/*tp_name*/
   sizeof(Oobject),       	/*tp_basicsize*/
   0,	       			/*tp_itemsize*/
@@ -626,8 +625,7 @@
 "Simple type for treating strings as input file streams");
 
 static PyTypeObject Itype = {
-  PyObject_HEAD_INIT(NULL)
-  0,					/*ob_size*/
+  PyVarObject_HEAD_INIT(NULL, 0)
   "cStringIO.StringI",			/*tp_name*/
   sizeof(Iobject),			/*tp_basicsize*/
   0,					/*tp_itemsize*/
@@ -737,8 +735,8 @@
   d = PyModule_GetDict(m);
   
   /* Export C API */
-  Itype.ob_type=&PyType_Type;
-  Otype.ob_type=&PyType_Type;
+  Py_Type(&Itype)=&PyType_Type;
+  Py_Type(&Otype)=&PyType_Type;
   if (PyType_Ready(&Otype) < 0) return;
   if (PyType_Ready(&Itype) < 0) return;
   PyDict_SetItemString(d,"cStringIO_CAPI",

Modified: python/branches/py3k-struni/Modules/cjkcodecs/multibytecodec.c
==============================================================================
--- python/branches/py3k-struni/Modules/cjkcodecs/multibytecodec.c	(original)
+++ python/branches/py3k-struni/Modules/cjkcodecs/multibytecodec.c	Sat Jul 21 19:22:18 2007
@@ -676,8 +676,7 @@
 }
 
 static PyTypeObject MultibyteCodec_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"MultibyteCodec",		/* tp_name */
 	sizeof(MultibyteCodecObject),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -952,12 +951,11 @@
 {
 	PyObject_GC_UnTrack(self);
 	ERROR_DECREF(self->errors);
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static PyTypeObject MultibyteIncrementalEncoder_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"MultibyteIncrementalEncoder",	/* tp_name */
 	sizeof(MultibyteIncrementalEncoderObject), /* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1153,12 +1151,11 @@
 {
 	PyObject_GC_UnTrack(self);
 	ERROR_DECREF(self->errors);
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static PyTypeObject MultibyteIncrementalDecoder_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"MultibyteIncrementalDecoder",	/* tp_name */
 	sizeof(MultibyteIncrementalDecoderObject), /* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1488,12 +1485,11 @@
 	PyObject_GC_UnTrack(self);
 	ERROR_DECREF(self->errors);
 	Py_DECREF(self->stream);
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static PyTypeObject MultibyteStreamReader_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"MultibyteStreamReader",	/* tp_name */
 	sizeof(MultibyteStreamReaderObject), /* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1692,7 +1688,7 @@
 	PyObject_GC_UnTrack(self);
 	ERROR_DECREF(self->errors);
 	Py_DECREF(self->stream);
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static struct PyMethodDef mbstreamwriter_methods[] = {
@@ -1713,8 +1709,7 @@
 };
 
 static PyTypeObject MultibyteStreamWriter_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"MultibyteStreamWriter",	/* tp_name */
 	sizeof(MultibyteStreamWriterObject), /* tp_basicsize */
 	0,				/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/datetimemodule.c	(original)
+++ python/branches/py3k-struni/Modules/datetimemodule.c	Sat Jul 21 19:22:18 2007
@@ -764,7 +764,7 @@
 	PyErr_Format(PyExc_TypeError,
 		     "tzinfo argument must be None or of a tzinfo subclass, "
 		     "not type '%s'",
-		     p->ob_type->tp_name);
+		     Py_Type(p)->tp_name);
 	return -1;
 }
 
@@ -855,7 +855,7 @@
 		PyErr_Format(PyExc_TypeError,
 			     "tzinfo.%s() must return None or "
 			     "timedelta, not '%s'",
-			     name, u->ob_type->tp_name);
+			     name, Py_Type(u)->tp_name);
 	}
 
 	Py_DECREF(u);
@@ -1421,7 +1421,7 @@
 {
 	PyErr_Format(PyExc_TypeError,
 		     "can't compare %s to %s",
-		     a->ob_type->tp_name, b->ob_type->tp_name);
+		     Py_Type(a)->tp_name, Py_Type(b)->tp_name);
 	return NULL;
 }
 
@@ -1865,7 +1865,7 @@
 
 	PyErr_Format(PyExc_TypeError,
 		     "unsupported type for timedelta %s component: %s",
-		     tag, num->ob_type->tp_name);
+		     tag, Py_Type(num)->tp_name);
 	return NULL;
 }
 
@@ -2027,7 +2027,7 @@
 static PyObject *
 delta_reduce(PyDateTime_Delta* self)
 {
-	return Py_BuildValue("ON", self->ob_type, delta_getstate(self));
+	return Py_BuildValue("ON", Py_Type(self), delta_getstate(self));
 }
 
 #define OFFSET(field)  offsetof(PyDateTime_Delta, field)
@@ -2095,8 +2095,7 @@
 };
 
 static PyTypeObject PyDateTime_DeltaType = {
-	PyObject_HEAD_INIT(NULL)
-	0,						/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"datetime.timedelta",				/* tp_name */
 	sizeof(PyDateTime_Delta),			/* tp_basicsize */
 	0,						/* tp_itemsize */
@@ -2504,7 +2503,7 @@
 	tuple = Py_BuildValue("iii", year, month, day);
 	if (tuple == NULL)
 		return NULL;
-	clone = date_new(self->ob_type, tuple, NULL);
+	clone = date_new(Py_Type(self), tuple, NULL);
 	Py_DECREF(tuple);
 	return clone;
 }
@@ -2635,8 +2634,7 @@
 };
 
 static PyTypeObject PyDateTime_DateType = {
-	PyObject_HEAD_INIT(NULL)
-	0,						/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"datetime.date",				/* tp_name */
 	sizeof(PyDateTime_Date),			/* tp_basicsize */
 	0,						/* tp_itemsize */
@@ -2859,10 +2857,10 @@
 
 	if (state == Py_None) {
 		Py_DECREF(state);
-		return Py_BuildValue("(ON)", self->ob_type, args);
+		return Py_BuildValue("(ON)", Py_Type(self), args);
 	}
 	else
-		return Py_BuildValue("(ONN)", self->ob_type, args, state);
+		return Py_BuildValue("(ONN)", Py_Type(self), args, state);
 }
 
 static PyMethodDef tzinfo_methods[] = {
@@ -2890,8 +2888,7 @@
 PyDoc_STR("Abstract base class for time zone info objects.");
 
 static PyTypeObject PyDateTime_TZInfoType = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"datetime.tzinfo",			/* tp_name */
 	sizeof(PyDateTime_TZInfo),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3056,7 +3053,7 @@
 	if (HASTZINFO(self)) {
 		Py_XDECREF(self->tzinfo);
 	}
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 /*
@@ -3089,7 +3086,7 @@
 static PyObject *
 time_repr(PyDateTime_Time *self)
 {
-	const char *type_name = self->ob_type->tp_name;
+	const char *type_name = Py_Type(self)->tp_name;
 	int h = TIME_GET_HOUR(self);
 	int m = TIME_GET_MINUTE(self);
 	int s = TIME_GET_SECOND(self);
@@ -3296,7 +3293,7 @@
 	tuple = Py_BuildValue("iiiiO", hh, mm, ss, us, tzinfo);
 	if (tuple == NULL)
 		return NULL;
-	clone = time_new(self->ob_type, tuple, NULL);
+	clone = time_new(Py_Type(self), tuple, NULL);
 	Py_DECREF(tuple);
 	return clone;
 }
@@ -3350,7 +3347,7 @@
 static PyObject *
 time_reduce(PyDateTime_Time *self, PyObject *arg)
 {
-	return Py_BuildValue("(ON)", self->ob_type, time_getstate(self));
+	return Py_BuildValue("(ON)", Py_Type(self), time_getstate(self));
 }
 
 static PyMethodDef time_methods[] = {
@@ -3400,8 +3397,7 @@
 };
 
 static PyTypeObject PyDateTime_TimeType = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"datetime.time",			/* tp_name */
 	sizeof(PyDateTime_Time),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3842,7 +3838,7 @@
 	if (HASTZINFO(self)) {
 		Py_XDECREF(self->tzinfo);
 	}
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 /*
@@ -3990,7 +3986,7 @@
 static PyObject *
 datetime_repr(PyDateTime_DateTime *self)
 {
-	const char *type_name = self->ob_type->tp_name;
+	const char *type_name = Py_Type(self)->tp_name;
 	PyObject *baserepr;
 
 	if (DATE_GET_MICROSECOND(self)) {
@@ -4206,7 +4202,7 @@
 	tuple = Py_BuildValue("iiiiiiiO", y, m, d, hh, mm, ss, us, tzinfo);
 	if (tuple == NULL)
 		return NULL;
-	clone = datetime_new(self->ob_type, tuple, NULL);
+	clone = datetime_new(Py_Type(self), tuple, NULL);
 	Py_DECREF(tuple);
 	return clone;
 }
@@ -4394,7 +4390,7 @@
 static PyObject *
 datetime_reduce(PyDateTime_DateTime *self, PyObject *arg)
 {
-	return Py_BuildValue("(ON)", self->ob_type, datetime_getstate(self));
+	return Py_BuildValue("(ON)", Py_Type(self), datetime_getstate(self));
 }
 
 static PyMethodDef datetime_methods[] = {
@@ -4494,8 +4490,7 @@
 };
 
 static PyTypeObject PyDateTime_DateTimeType = {
-	PyObject_HEAD_INIT(NULL)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"datetime.datetime",			/* tp_name */
 	sizeof(PyDateTime_DateTime),		/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/dbmmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/dbmmodule.c	(original)
+++ python/branches/py3k-struni/Modules/dbmmodule.c	Sat Jul 21 19:22:18 2007
@@ -36,7 +36,7 @@
 
 static PyTypeObject Dbmtype;
 
-#define is_dbmobject(v) ((v)->ob_type == &Dbmtype)
+#define is_dbmobject(v) (Py_Type(v) == &Dbmtype)
 #define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \
                { PyErr_SetString(DbmError, "DBM object has already been closed"); \
                  return NULL; }
@@ -333,8 +333,7 @@
 }
 
 static PyTypeObject Dbmtype = {
-	PyObject_HEAD_INIT(NULL)
-	0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"dbm.dbm",
 	sizeof(dbmobject),
 	0,

Modified: python/branches/py3k-struni/Modules/dlmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/dlmodule.c	(original)
+++ python/branches/py3k-struni/Modules/dlmodule.c	Sat Jul 21 19:22:18 2007
@@ -62,7 +62,7 @@
 		name = PyUnicode_AsString(args);
 	} else {
 		PyErr_Format(PyExc_TypeError, "expected string, found %.200s",
-			     args->ob_type->tp_name);
+			     Py_Type(args)->tp_name);
 		return NULL;
 	}
 	func = dlsym(xp->dl_handle, name);
@@ -143,8 +143,7 @@
 
 
 static PyTypeObject Dltype = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"dl.dl",		/*tp_name*/
 	sizeof(dlobject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -239,7 +238,7 @@
 	PyObject *m, *d, *x;
 
 	/* Initialize object type */
-	Dltype.ob_type = &PyType_Type;
+	Py_Type(&Dltype) = &PyType_Type;
 
 	/* Create the module and add the functions */
 	m = Py_InitModule("dl", dl_methods);

Modified: python/branches/py3k-struni/Modules/gcmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/gcmodule.c	(original)
+++ python/branches/py3k-struni/Modules/gcmodule.c	Sat Jul 21 19:22:18 2007
@@ -237,7 +237,7 @@
 	PyGC_Head *gc = containers->gc.gc_next;
 	for (; gc != containers; gc = gc->gc.gc_next) {
 		assert(gc->gc.gc_refs == GC_REACHABLE);
-		gc->gc.gc_refs = FROM_GC(gc)->ob_refcnt;
+		gc->gc.gc_refs = Py_Refcnt(FROM_GC(gc));
 		/* Python's cyclic gc should never see an incoming refcount
 		 * of 0:  if something decref'ed to 0, it should have been
 		 * deallocated immediately at that time.
@@ -289,7 +289,7 @@
 	traverseproc traverse;
 	PyGC_Head *gc = containers->gc.gc_next;
 	for (; gc != containers; gc=gc->gc.gc_next) {
-		traverse = FROM_GC(gc)->ob_type->tp_traverse;
+		traverse = Py_Type(FROM_GC(gc))->tp_traverse;
 		(void) traverse(FROM_GC(gc),
 			       (visitproc)visit_decref,
 			       NULL);
@@ -374,7 +374,7 @@
                          * the next object to visit.
                          */
                         PyObject *op = FROM_GC(gc);
-                        traverseproc traverse = op->ob_type->tp_traverse;
+                        traverseproc traverse = Py_Type(op)->tp_traverse;
                         assert(gc->gc.gc_refs > 0);
                         gc->gc.gc_refs = GC_REACHABLE;
                         (void) traverse(op,
@@ -464,7 +464,7 @@
 	PyGC_Head *gc = finalizers->gc.gc_next;
 	for (; gc != finalizers; gc = gc->gc.gc_next) {
 		/* Note that the finalizers list may grow during this. */
-		traverse = FROM_GC(gc)->ob_type->tp_traverse;
+		traverse = Py_Type(FROM_GC(gc))->tp_traverse;
 		(void) traverse(FROM_GC(gc),
 				(visitproc)visit_move,
 				(void *)finalizers);
@@ -509,7 +509,7 @@
 		assert(IS_TENTATIVELY_UNREACHABLE(op));
 		next = gc->gc.gc_next;
 
-		if (! PyType_SUPPORTS_WEAKREFS(op->ob_type))
+		if (! PyType_SUPPORTS_WEAKREFS(Py_Type(op)))
 			continue;
 
 		/* It supports weakrefs.  Does it have any? */
@@ -629,7 +629,7 @@
 {
 	if (debug & DEBUG_OBJECTS) {
 		PySys_WriteStderr("gc: %.100s <%.100s %p>\n",
-				  msg, op->ob_type->tp_name, op);
+				  msg, Py_Type(op)->tp_name, op);
 	}
 }
 
@@ -683,7 +683,7 @@
 			PyList_Append(garbage, op);
 		}
 		else {
-			if ((clear = op->ob_type->tp_clear) != NULL) {
+			if ((clear = Py_Type(op)->tp_clear) != NULL) {
 				Py_INCREF(op);
 				clear(op);
 				Py_DECREF(op);
@@ -1053,7 +1053,7 @@
 	traverseproc traverse;
 	for (gc = list->gc.gc_next; gc != list; gc = gc->gc.gc_next) {
 		obj = FROM_GC(gc);
-		traverse = obj->ob_type->tp_traverse;
+		traverse = Py_Type(obj)->tp_traverse;
 		if (obj == objs || obj == resultlist)
 			continue;
 		if (traverse(obj, (visitproc)referrersvisit, objs)) {
@@ -1110,7 +1110,7 @@
 
 		if (! PyObject_IS_GC(obj))
 			continue;
-		traverse = obj->ob_type->tp_traverse;
+		traverse = Py_Type(obj)->tp_traverse;
 		if (! traverse)
 			continue;
 		if (traverse(obj, (visitproc)referentsvisit, result)) {
@@ -1332,13 +1332,13 @@
 PyVarObject *
 _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems)
 {
-	const size_t basicsize = _PyObject_VAR_SIZE(op->ob_type, nitems);
+	const size_t basicsize = _PyObject_VAR_SIZE(Py_Type(op), nitems);
 	PyGC_Head *g = AS_GC(op);
 	g = (PyGC_Head *)PyObject_REALLOC(g,  sizeof(PyGC_Head) + basicsize);
 	if (g == NULL)
 		return (PyVarObject *)PyErr_NoMemory();
 	op = (PyVarObject *) FROM_GC(g);
-	op->ob_size = nitems;
+	Py_Size(op) = nitems;
 	return op;
 }
 

Modified: python/branches/py3k-struni/Modules/gdbmmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/gdbmmodule.c	(original)
+++ python/branches/py3k-struni/Modules/gdbmmodule.c	Sat Jul 21 19:22:18 2007
@@ -36,7 +36,7 @@
 
 static PyTypeObject Dbmtype;
 
-#define is_dbmobject(v) ((v)->ob_type == &Dbmtype)
+#define is_dbmobject(v) (Py_Type(v) == &Dbmtype)
 #define check_dbmobject_open(v) if ((v)->di_dbm == NULL) \
     { PyErr_SetString(DbmError, "GDBM object has already been closed"); \
       return NULL; }
@@ -393,8 +393,7 @@
 }
 
 static PyTypeObject Dbmtype = {
-    PyObject_HEAD_INIT(0)
-    0,
+    PyVarObject_HEAD_INIT(0, 0)
     "gdbm.gdbm",
     sizeof(dbmobject),
     0,

Modified: python/branches/py3k-struni/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/itertoolsmodule.c	(original)
+++ python/branches/py3k-struni/Modules/itertoolsmodule.c	Sat Jul 21 19:22:18 2007
@@ -59,7 +59,7 @@
 	Py_XDECREF(gbo->tgtkey);
 	Py_XDECREF(gbo->currkey);
 	Py_XDECREF(gbo->currvalue);
-	gbo->ob_type->tp_free(gbo);
+	Py_Type(gbo)->tp_free(gbo);
 }
 
 static int
@@ -139,8 +139,7 @@
 (key, sub-iterator) grouped by each value of key(value).\n");
 
 static PyTypeObject groupby_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.groupby",		/* tp_name */
 	sizeof(groupbyobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -261,8 +260,7 @@
 }
 
 static PyTypeObject _grouper_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools._grouper",		/* tp_name */
 	sizeof(_grouperobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -415,8 +413,7 @@
 PyDoc_STRVAR(teedataobject_doc, "Data container common to multiple tee objects.");
 
 static PyTypeObject teedataobject_type = {
-	PyObject_HEAD_INIT(0)	/* Must fill in type value later */
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(0, 0)	/* Must fill in type value later */
 	"itertools.tee_dataobject",		/* tp_name */
 	sizeof(teedataobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -572,8 +569,7 @@
 };
 
 static PyTypeObject tee_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.tee",		/* tp_name */
 	sizeof(teeobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -718,7 +714,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->saved);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -768,8 +764,7 @@
 Then repeat the sequence indefinitely.");
 
 static PyTypeObject cycle_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.cycle",		/* tp_name */
 	sizeof(cycleobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -862,7 +857,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->func);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -882,7 +877,7 @@
 	PyObject *(*iternext)(PyObject *);
 
 	assert(PyIter_Check(it));
-	iternext = *it->ob_type->tp_iternext;
+	iternext = *Py_Type(it)->tp_iternext;
 	for (;;) {
 		item = iternext(it);
 		if (item == NULL)
@@ -912,8 +907,7 @@
 Afterwards, return every element until the iterable is exhausted.");
 
 static PyTypeObject dropwhile_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.dropwhile",		/* tp_name */
 	sizeof(dropwhileobject),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1006,7 +1000,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->func);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1028,7 +1022,7 @@
 		return NULL;
 
 	assert(PyIter_Check(it));
-	item = (*it->ob_type->tp_iternext)(it);
+	item = (*Py_Type(it)->tp_iternext)(it);
 	if (item == NULL)
 		return NULL;
 
@@ -1053,8 +1047,7 @@
 predicate evaluates to true for each entry.");
 
 static PyTypeObject takewhile_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.takewhile",		/* tp_name */
 	sizeof(takewhileobject),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1197,7 +1190,7 @@
 {
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1216,7 +1209,7 @@
 	PyObject *(*iternext)(PyObject *);
 
 	assert(PyIter_Check(it));
-	iternext = *it->ob_type->tp_iternext;
+	iternext = *Py_Type(it)->tp_iternext;
 	while (lz->cnt < lz->next) {
 		item = iternext(it);
 		if (item == NULL)
@@ -1249,8 +1242,7 @@
 but returns an iterator.");
 
 static PyTypeObject islice_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.islice",		/* tp_name */
 	sizeof(isliceobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1341,7 +1333,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->func);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1360,7 +1352,7 @@
 	PyObject *it = lz->it;
 
 	assert(PyIter_Check(it));
-	args = (*it->ob_type->tp_iternext)(it);
+	args = (*Py_Type(it)->tp_iternext)(it);
 	if (args == NULL)
 		return NULL;
 	if (!PyTuple_CheckExact(args)) {
@@ -1381,8 +1373,7 @@
 with a argument tuple taken from the given sequence.");
 
 static PyTypeObject starmap_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.starmap",		/* tp_name */
 	sizeof(starmapobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1487,7 +1478,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->iters);
 	Py_XDECREF(lz->func);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1561,8 +1552,7 @@
 iterables.");
 
 static PyTypeObject imap_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.imap",		/* tp_name */
 	sizeof(imapobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1666,7 +1656,7 @@
 {
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->ittuple);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1706,8 +1696,7 @@
 iterable, until all of the iterables are exhausted.");
 
 static PyTypeObject chain_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.chain",		/* tp_name */
 	sizeof(chainobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1798,7 +1787,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->func);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1818,7 +1807,7 @@
 	PyObject *(*iternext)(PyObject *);
 
 	assert(PyIter_Check(it));
-	iternext = *it->ob_type->tp_iternext;
+	iternext = *Py_Type(it)->tp_iternext;
 	for (;;) {
 		item = iternext(it);
 		if (item == NULL)
@@ -1850,8 +1839,7 @@
 If function is None, return the items that are true.");
 
 static PyTypeObject ifilter_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.ifilter",		/* tp_name */
 	sizeof(ifilterobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -1943,7 +1931,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->func);
 	Py_XDECREF(lz->it);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -1963,7 +1951,7 @@
 	PyObject *(*iternext)(PyObject *);
 
 	assert(PyIter_Check(it));
-	iternext = *it->ob_type->tp_iternext;
+	iternext = *Py_Type(it)->tp_iternext;
 	for (;;) {
 		item = iternext(it);
 		if (item == NULL)
@@ -1995,8 +1983,7 @@
 If function is None, return the items that are false.");
 
 static PyTypeObject ifilterfalse_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.ifilterfalse",	/* tp_name */
 	sizeof(ifilterfalseobject),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2094,8 +2081,7 @@
 integers starting from zero or, if specified, from firstval.");
 
 static PyTypeObject count_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.count",		/* tp_name */
 	sizeof(countobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2214,7 +2200,7 @@
 	PyObject_GC_UnTrack(lz);
 	Py_XDECREF(lz->ittuple);
 	Py_XDECREF(lz->result);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -2237,12 +2223,12 @@
 
 	if (tuplesize == 0)
 		return NULL;
-	if (result->ob_refcnt == 1) {
+	if (Py_Refcnt(result) == 1) {
 		Py_INCREF(result);
 		for (i=0 ; i < tuplesize ; i++) {
 			it = PyTuple_GET_ITEM(lz->ittuple, i);
 			assert(PyIter_Check(it));
-			item = (*it->ob_type->tp_iternext)(it);
+			item = (*Py_Type(it)->tp_iternext)(it);
 			if (item == NULL) {
 				Py_DECREF(result);
 				return NULL;
@@ -2258,7 +2244,7 @@
 		for (i=0 ; i < tuplesize ; i++) {
 			it = PyTuple_GET_ITEM(lz->ittuple, i);
 			assert(PyIter_Check(it));
-			item = (*it->ob_type->tp_iternext)(it);
+			item = (*Py_Type(it)->tp_iternext)(it);
 			if (item == NULL) {
 				Py_DECREF(result);
 				return NULL;
@@ -2280,8 +2266,7 @@
 a list.");
 
 static PyTypeObject izip_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.izip",		/* tp_name */
 	sizeof(izipobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2365,7 +2350,7 @@
 {
 	PyObject_GC_UnTrack(ro);
 	Py_XDECREF(ro->element);
-	ro->ob_type->tp_free(ro);
+	Py_Type(ro)->tp_free(ro);
 }
 
 static int
@@ -2418,8 +2403,7 @@
 endlessly.");
 
 static PyTypeObject repeat_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.repeat",		/* tp_name */
 	sizeof(repeatobject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2551,7 +2535,7 @@
 	Py_XDECREF(lz->ittuple);
 	Py_XDECREF(lz->result);
 	Py_XDECREF(lz->fillvalue);
-	lz->ob_type->tp_free(lz);
+	Py_Type(lz)->tp_free(lz);
 }
 
 static int
@@ -2577,7 +2561,7 @@
 		return NULL;
         if (lz->numactive == 0)
                 return NULL;
-	if (result->ob_refcnt == 1) {
+	if (Py_Refcnt(result) == 1) {
 		Py_INCREF(result);
 		for (i=0 ; i < tuplesize ; i++) {
 			it = PyTuple_GET_ITEM(lz->ittuple, i);
@@ -2586,7 +2570,7 @@
                                 item = lz->fillvalue;
                         } else {
                                 assert(PyIter_Check(it));
-                                item = (*it->ob_type->tp_iternext)(it);
+                                item = (*Py_Type(it)->tp_iternext)(it);
                                 if (item == NULL) {
                                         lz->numactive -= 1;      
                                         if (lz->numactive == 0) {
@@ -2615,7 +2599,7 @@
                                 item = lz->fillvalue;
                         } else {
                                 assert(PyIter_Check(it));
-                                item = (*it->ob_type->tp_iternext)(it);
+                                item = (*Py_Type(it)->tp_iternext)(it);
                                 if (item == NULL) {
                                         lz->numactive -= 1;      
                                         if (lz->numactive == 0) {
@@ -2647,8 +2631,7 @@
 ");
 
 static PyTypeObject iziplongest_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"itertools.izip_longest",	/* tp_name */
 	sizeof(iziplongestobject),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2747,7 +2730,7 @@
 		NULL
 	};
 
-	teedataobject_type.ob_type = &PyType_Type;
+	Py_Type(&teedataobject_type) = &PyType_Type;
 	m = Py_InitModule3("itertools", module_methods, module_doc);
 	if (m == NULL)
 		return;

Modified: python/branches/py3k-struni/Modules/linuxaudiodev.c
==============================================================================
--- python/branches/py3k-struni/Modules/linuxaudiodev.c	(original)
+++ python/branches/py3k-struni/Modules/linuxaudiodev.c	Sat Jul 21 19:22:18 2007
@@ -441,8 +441,7 @@
 }
 
 static PyTypeObject Ladtype = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,				/*ob_size*/
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "linuxaudiodev.linux_audio_device", /*tp_name*/
     sizeof(lad_t),		/*tp_size*/
     0,				/*tp_itemsize*/

Modified: python/branches/py3k-struni/Modules/mathmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/mathmodule.c	(original)
+++ python/branches/py3k-struni/Modules/mathmodule.c	Sat Jul 21 19:22:18 2007
@@ -229,7 +229,7 @@
 		   log(x) + log(2) * e * SHIFT.
 		   CAUTION:  e*SHIFT may overflow using int arithmetic,
 		   so force use of double. */
-		x = func(x) + (e * (double)SHIFT) * func(2.0);
+		x = func(x) + (e * (double)PyLong_SHIFT) * func(2.0);
 		return PyFloat_FromDouble(x);
 	}
 

Modified: python/branches/py3k-struni/Modules/mmapmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/mmapmodule.c	(original)
+++ python/branches/py3k-struni/Modules/mmapmodule.c	Sat Jul 21 19:22:18 2007
@@ -782,8 +782,7 @@
 };
 
 static PyTypeObject mmap_object_type = {
-	PyObject_HEAD_INIT(0) /* patched in module init */
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(0, 0) /* patched in module init */
 	"mmap.mmap",				/* tp_name */
 	sizeof(mmap_object),			/* tp_size */
 	0,					/* tp_itemsize */
@@ -1141,7 +1140,7 @@
 	PyObject *dict, *module;
 
 	/* Patch the object type */
-	mmap_object_type.ob_type = &PyType_Type;
+	Py_Type(&mmap_object_type) = &PyType_Type;
 
 	module = Py_InitModule("mmap", mmap_functions);
 	if (module == NULL)

Modified: python/branches/py3k-struni/Modules/operator.c
==============================================================================
--- python/branches/py3k-struni/Modules/operator.c	(original)
+++ python/branches/py3k-struni/Modules/operator.c	Sat Jul 21 19:22:18 2007
@@ -387,8 +387,7 @@
 After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])");
 
 static PyTypeObject itemgetter_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"operator.itemgetter",		/* tp_name */
 	sizeof(itemgetterobject),	/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -525,8 +524,7 @@
 After, g=attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).");
 
 static PyTypeObject attrgetter_type = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"operator.attrgetter",		/* tp_name */
 	sizeof(attrgetterobject),	/* tp_basicsize */
 	0,				/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/ossaudiodev.c
==============================================================================
--- python/branches/py3k-struni/Modules/ossaudiodev.c	(original)
+++ python/branches/py3k-struni/Modules/ossaudiodev.c	Sat Jul 21 19:22:18 2007
@@ -841,8 +841,7 @@
 }
 
 static PyTypeObject OSSAudioType = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,                          /*ob_size*/
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "ossaudiodev.oss_audio_device", /*tp_name*/
     sizeof(oss_audio_t),        /*tp_size*/
     0,                          /*tp_itemsize*/
@@ -856,8 +855,7 @@
 };
 
 static PyTypeObject OSSMixerType = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,                              /*ob_size*/
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "ossaudiodev.oss_mixer_device", /*tp_name*/
     sizeof(oss_mixer_t),            /*tp_size*/
     0,                              /*tp_itemsize*/

Modified: python/branches/py3k-struni/Modules/parsermodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/parsermodule.c	(original)
+++ python/branches/py3k-struni/Modules/parsermodule.c	Sat Jul 21 19:22:18 2007
@@ -166,8 +166,7 @@
 
 static
 PyTypeObject PyST_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,
+    PyVarObject_HEAD_INIT(NULL, 0)
     "parser.st",                        /* tp_name              */
     (int) sizeof(PyST_Object),          /* tp_basicsize         */
     0,                                  /* tp_itemsize          */
@@ -694,7 +693,7 @@
                 PyErr_Format(parser_error,
                              "second item in terminal node must be a string,"
                              " found %s",
-                             temp->ob_type->tp_name);
+                             Py_Type(temp)->tp_name);
                 Py_DECREF(temp);
                 return 0;
             }
@@ -707,7 +706,7 @@
                         PyErr_Format(parser_error,
                                      "third item in terminal node must be an"
                                      " integer, found %s",
-				     temp->ob_type->tp_name);
+				     Py_Type(temp)->tp_name);
                         Py_DECREF(o);
                         Py_DECREF(temp);
                         return 0;
@@ -3049,7 +3048,7 @@
 {
     PyObject *module, *copyreg;
 
-    PyST_Type.ob_type = &PyType_Type;
+    Py_Type(&PyST_Type) = &PyType_Type;
     module = Py_InitModule("parser", parser_functions);
     if (module == NULL)
     	return;

Modified: python/branches/py3k-struni/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/posixmodule.c	(original)
+++ python/branches/py3k-struni/Modules/posixmodule.c	Sat Jul 21 19:22:18 2007
@@ -2577,7 +2577,7 @@
 	long intval;
 	if (PyFloat_Check(t)) {
 		double tval = PyFloat_AsDouble(t);
-		PyObject *intobj = t->ob_type->tp_as_number->nb_int(t);
+		PyObject *intobj = Py_Type(t)->tp_as_number->nb_int(t);
 		if (!intobj)
 			return -1;
 		intval = PyInt_AsLong(intobj);

Modified: python/branches/py3k-struni/Modules/pyexpat.c
==============================================================================
--- python/branches/py3k-struni/Modules/pyexpat.c	(original)
+++ python/branches/py3k-struni/Modules/pyexpat.c	Sat Jul 21 19:22:18 2007
@@ -927,7 +927,7 @@
     if (!PyString_Check(str)) {
         PyErr_Format(PyExc_TypeError,
                      "read() did not return a string object (type=%.400s)",
-                     str->ob_type->tp_name);
+                     Py_Type(str)->tp_name);
         goto finally;
     }
     len = PyString_GET_SIZE(str);
@@ -1621,8 +1621,7 @@
 PyDoc_STRVAR(Xmlparsetype__doc__, "XML parser");
 
 static PyTypeObject Xmlparsetype = {
-	PyObject_HEAD_INIT(NULL)
-	0,				/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"pyexpat.xmlparser",		/*tp_name*/
 	sizeof(xmlparseobject) + PyGC_HEAD_SIZE,/*tp_basicsize*/
 	0,				/*tp_itemsize*/
@@ -1790,7 +1789,7 @@
     if (modelmod_name == NULL)
         return;
 
-    Xmlparsetype.ob_type = &PyType_Type;
+    Py_Type(&Xmlparsetype) = &PyType_Type;
 
     /* Create the module and add the functions */
     m = Py_InitModule3(MODULE_NAME, pyexpat_methods,

Modified: python/branches/py3k-struni/Modules/selectmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/selectmodule.c	(original)
+++ python/branches/py3k-struni/Modules/selectmodule.c	Sat Jul 21 19:22:18 2007
@@ -587,8 +587,7 @@
 static PyTypeObject poll_Type = {
 	/* The ob_type field must be initialized in the module init function
 	 * to be portable to Windows without using C++. */
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"select.poll",		/*tp_name*/
 	sizeof(pollObject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -706,7 +705,7 @@
 #else
 	{
 #endif
-		poll_Type.ob_type = &PyType_Type;
+		Py_Type(&poll_Type) = &PyType_Type;
 		PyModule_AddIntConstant(m, "POLLIN", POLLIN);
 		PyModule_AddIntConstant(m, "POLLPRI", POLLPRI);
 		PyModule_AddIntConstant(m, "POLLOUT", POLLOUT);

Modified: python/branches/py3k-struni/Modules/sha256module.c
==============================================================================
--- python/branches/py3k-struni/Modules/sha256module.c	(original)
+++ python/branches/py3k-struni/Modules/sha256module.c	Sat Jul 21 19:22:18 2007
@@ -409,7 +409,7 @@
 {
     SHAobject *newobj;
 
-    if (((PyObject*)self)->ob_type == &SHA256type) {
+    if (Py_Type(self) == &SHA256type) {
         if ( (newobj = newSHA256object())==NULL)
             return NULL;
     } else {
@@ -536,8 +536,7 @@
 };
 
 static PyTypeObject SHA224type = {
-    PyObject_HEAD_INIT(NULL)
-    0,			/*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_sha256.sha224",	/*tp_name*/
     sizeof(SHAobject),	/*tp_size*/
     0,			/*tp_itemsize*/
@@ -571,8 +570,7 @@
 };
 
 static PyTypeObject SHA256type = {
-    PyObject_HEAD_INIT(NULL)
-    0,			/*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_sha256.sha256",	/*tp_name*/
     sizeof(SHAobject),	/*tp_size*/
     0,			/*tp_itemsize*/
@@ -689,10 +687,10 @@
 {
     PyObject *m;
 
-    SHA224type.ob_type = &PyType_Type;
+    Py_Type(&SHA224type) = &PyType_Type;
     if (PyType_Ready(&SHA224type) < 0)
         return;
-    SHA256type.ob_type = &PyType_Type;
+    Py_Type(&SHA256type) = &PyType_Type;
     if (PyType_Ready(&SHA256type) < 0)
         return;
     m = Py_InitModule("_sha256", SHA_functions);

Modified: python/branches/py3k-struni/Modules/sha512module.c
==============================================================================
--- python/branches/py3k-struni/Modules/sha512module.c	(original)
+++ python/branches/py3k-struni/Modules/sha512module.c	Sat Jul 21 19:22:18 2007
@@ -602,8 +602,7 @@
 };
 
 static PyTypeObject SHA384type = {
-    PyObject_HEAD_INIT(NULL)
-    0,			/*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_sha512.sha384",	/*tp_name*/
     sizeof(SHAobject),	/*tp_size*/
     0,			/*tp_itemsize*/
@@ -637,8 +636,7 @@
 };
 
 static PyTypeObject SHA512type = {
-    PyObject_HEAD_INIT(NULL)
-    0,			/*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "_sha512.sha512",	/*tp_name*/
     sizeof(SHAobject),	/*tp_size*/
     0,			/*tp_itemsize*/
@@ -755,10 +753,10 @@
 {
     PyObject *m;
 
-    SHA384type.ob_type = &PyType_Type;
+    Py_Type(&SHA384type) = &PyType_Type;
     if (PyType_Ready(&SHA384type) < 0)
         return;
-    SHA512type.ob_type = &PyType_Type;
+    Py_Type(&SHA512type) = &PyType_Type;
     if (PyType_Ready(&SHA512type) < 0)
         return;
     m = Py_InitModule("_sha512", SHA_functions);

Modified: python/branches/py3k-struni/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/socketmodule.c	(original)
+++ python/branches/py3k-struni/Modules/socketmodule.c	Sat Jul 21 19:22:18 2007
@@ -1247,7 +1247,7 @@
 				PyExc_TypeError,
 				"getsockaddrarg: "
 				"AF_NETLINK address must be tuple, not %.500s",
-				args->ob_type->tp_name);
+				Py_Type(args)->tp_name);
 			return 0;
 		}
 		if (!PyArg_ParseTuple(args, "II:getsockaddrarg", &pid, &groups))
@@ -1270,7 +1270,7 @@
 				PyExc_TypeError,
 				"getsockaddrarg: "
 				"AF_INET address must be tuple, not %.500s",
-				args->ob_type->tp_name);
+				Py_Type(args)->tp_name);
 			return 0;
 		}
 		if (!PyArg_ParseTuple(args, "eti:getsockaddrarg",
@@ -1300,7 +1300,7 @@
 				PyExc_TypeError,
 				"getsockaddrarg: "
 				"AF_INET6 address must be tuple, not %.500s",
-				args->ob_type->tp_name);
+				Py_Type(args)->tp_name);
 			return 0;
 		}
 		if (!PyArg_ParseTuple(args, "eti|ii",
@@ -1422,7 +1422,7 @@
 				PyExc_TypeError,
 				"getsockaddrarg: "
 				"AF_PACKET address must be tuple, not %.500s",
-				args->ob_type->tp_name);
+				Py_Type(args)->tp_name);
 			return 0;
 		}
 		if (!PyArg_ParseTuple(args, "si|iis#", &interfaceName,
@@ -2771,7 +2771,7 @@
 {
 	if (s->sock_fd != -1)
 		(void) SOCKETCLOSE(s->sock_fd);
-	s->ob_type->tp_free((PyObject *)s);
+	Py_Type(s)->tp_free((PyObject *)s);
 }
 
 
@@ -2861,8 +2861,7 @@
 /* Type object for socket objects. */
 
 static PyTypeObject sock_type = {
-	PyObject_HEAD_INIT(0)	/* Must fill in type value later */
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(0, 0)	/* Must fill in type value later */
 	"_socket.socket",			/* tp_name */
 	sizeof(PySocketSockObject),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3445,7 +3444,7 @@
 	else
 		return PyErr_Format(PyExc_TypeError,
 				    "expected int/long, %s found",
-				    arg->ob_type->tp_name);
+				    Py_Type(arg)->tp_name);
 	if (x == (unsigned long) -1 && PyErr_Occurred())
 		return NULL;
 	return PyLong_FromUnsignedLong(ntohl(x));
@@ -3504,7 +3503,7 @@
 	else
 		return PyErr_Format(PyExc_TypeError,
 				    "expected int/long, %s found",
-				    arg->ob_type->tp_name);
+				    Py_Type(arg)->tp_name);
 	return PyLong_FromUnsignedLong(htonl((unsigned long)x));
 }
 
@@ -4142,7 +4141,7 @@
 	if (!os_init())
 		return;
 
-	sock_type.ob_type = &PyType_Type;
+	Py_Type(&sock_type) = &PyType_Type;
 	m = Py_InitModule3(PySocket_MODULE_NAME,
 			   socket_methods,
 			   socket_doc);

Modified: python/branches/py3k-struni/Modules/sunaudiodev.c
==============================================================================
--- python/branches/py3k-struni/Modules/sunaudiodev.c	(original)
+++ python/branches/py3k-struni/Modules/sunaudiodev.c	Sat Jul 21 19:22:18 2007
@@ -42,8 +42,8 @@
 
 static PyObject *SunAudioError;
 
-#define is_sadobject(v)		((v)->ob_type == &Sadtype)
-#define is_sadstatusobject(v)	((v)->ob_type == &Sadstatustype)
+#define is_sadobject(v)		(Py_Type(v) == &Sadtype)
+#define is_sadstatusobject(v)	(Py_Type(v) == &Sadstatustype)
 
 
 static sadobject *
@@ -409,8 +409,7 @@
 
 
 static PyTypeObject Sadtype = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,				/*ob_size*/
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"sunaudiodev.sun_audio_device",	/*tp_name*/
 	sizeof(sadobject),		/*tp_size*/
 	0,				/*tp_itemsize*/
@@ -424,8 +423,7 @@
 };
 
 static PyTypeObject Sadstatustype = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,				/*ob_size*/
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"sunaudiodev.sun_audio_device_status", /*tp_name*/
 	sizeof(sadstatusobject),	/*tp_size*/
 	0,				/*tp_itemsize*/

Modified: python/branches/py3k-struni/Modules/threadmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/threadmodule.c	(original)
+++ python/branches/py3k-struni/Modules/threadmodule.c	Sat Jul 21 19:22:18 2007
@@ -126,8 +126,7 @@
 }
 
 static PyTypeObject Locktype = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,				/*ob_size*/
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"thread.lock",			/*tp_name*/
 	sizeof(lockobject),		/*tp_size*/
 	0,				/*tp_itemsize*/
@@ -251,7 +250,7 @@
 	}
 
 	local_clear(self);
-	self->ob_type->tp_free((PyObject*)self);
+	Py_Type(self)->tp_free((PyObject*)self);
 }
 
 static PyObject *
@@ -283,8 +282,8 @@
 		Py_INCREF(ldict);
 		self->dict = ldict; /* still borrowed */
 
-		if (self->ob_type->tp_init != PyBaseObject_Type.tp_init &&
-		    self->ob_type->tp_init((PyObject*)self, 
+		if (Py_Type(self)->tp_init != PyBaseObject_Type.tp_init &&
+		    Py_Type(self)->tp_init((PyObject*)self, 
 					   self->args, self->kw) < 0) {
 			/* we need to get rid of ldict from thread so
 			   we create a new one the next time we do an attr
@@ -336,8 +335,7 @@
 static PyObject *local_getattro(localobject *, PyObject *);
 
 static PyTypeObject localtype = {
-	PyObject_HEAD_INIT(NULL)
-	/* ob_size           */ 0,
+	PyVarObject_HEAD_INIT(NULL, 0)
 	/* tp_name           */ "thread._local",
 	/* tp_basicsize      */ sizeof(localobject),
 	/* tp_itemsize       */ 0,
@@ -388,7 +386,7 @@
 	if (ldict == NULL) 
 		return NULL;
 
-	if (self->ob_type != &localtype)
+	if (Py_Type(self) != &localtype)
 		/* use generic lookup for subtypes */
 		return PyObject_GenericGetAttr((PyObject *)self, name);
 

Modified: python/branches/py3k-struni/Modules/unicodedata.c
==============================================================================
--- python/branches/py3k-struni/Modules/unicodedata.c	(original)
+++ python/branches/py3k-struni/Modules/unicodedata.c	Sat Jul 21 19:22:18 2007
@@ -1134,8 +1134,7 @@
 static PyTypeObject UCD_Type = {
 	/* The ob_type field must be initialized in the module init function
 	 * to be portable to Windows without using C++. */
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"unicodedata.UCD",		/*tp_name*/
 	sizeof(PreviousDBVersion),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -1193,7 +1192,7 @@
 {
     PyObject *m, *v;
 
-    UCD_Type.ob_type = &PyType_Type;
+    Py_Type(&UCD_Type) = &PyType_Type;
 
     m = Py_InitModule3(
         "unicodedata", unicodedata_functions, unicodedata_docstring);

Modified: python/branches/py3k-struni/Modules/xxmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/xxmodule.c	(original)
+++ python/branches/py3k-struni/Modules/xxmodule.c	Sat Jul 21 19:22:18 2007
@@ -25,7 +25,7 @@
 
 static PyTypeObject Xxo_Type;
 
-#define XxoObject_Check(v)	((v)->ob_type == &Xxo_Type)
+#define XxoObject_Check(v)	(Py_Type(v) == &Xxo_Type)
 
 static XxoObject *
 newXxoObject(PyObject *arg)
@@ -97,8 +97,7 @@
 static PyTypeObject Xxo_Type = {
 	/* The ob_type field must be initialized in the module init function
 	 * to be portable to Windows without using C++. */
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"xxmodule.Xxo",		/*tp_name*/
 	sizeof(XxoObject),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -216,8 +215,7 @@
 static PyTypeObject Str_Type = {
 	/* The ob_type field must be initialized in the module init function
 	 * to be portable to Windows without using C++. */
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"xxmodule.Str",		/*tp_name*/
 	0,			/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -272,8 +270,7 @@
 static PyTypeObject Null_Type = {
 	/* The ob_type field must be initialized in the module init function
 	 * to be portable to Windows without using C++. */
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"xxmodule.Null",	/*tp_name*/
 	0,			/*tp_basicsize*/
 	0,			/*tp_itemsize*/

Modified: python/branches/py3k-struni/Modules/xxsubtype.c
==============================================================================
--- python/branches/py3k-struni/Modules/xxsubtype.c	(original)
+++ python/branches/py3k-struni/Modules/xxsubtype.c	Sat Jul 21 19:22:18 2007
@@ -101,8 +101,7 @@
 };
 
 static PyTypeObject spamlist_type = {
-	PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type))
-	0,
+	PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0)
 	"xxsubtype.spamlist",
 	sizeof(spamlistobject),
 	0,
@@ -193,8 +192,7 @@
 };
 
 static PyTypeObject spamdict_type = {
-	PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type))
-	0,
+	PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0)
 	"xxsubtype.spamdict",
 	sizeof(spamdictobject),
 	0,

Modified: python/branches/py3k-struni/Modules/zipimport.c
==============================================================================
--- python/branches/py3k-struni/Modules/zipimport.c	(original)
+++ python/branches/py3k-struni/Modules/zipimport.c	Sat Jul 21 19:22:18 2007
@@ -181,7 +181,7 @@
 	Py_XDECREF(self->archive);
 	Py_XDECREF(self->prefix);
 	Py_XDECREF(self->files);
-	self->ob_type->tp_free((PyObject *)self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static PyObject *
@@ -557,8 +557,7 @@
 #define DEFERRED_ADDRESS(ADDR) 0
 
 static PyTypeObject ZipImporter_Type = {
-	PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type))
-	0,
+	PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0)
 	"zipimport.zipimporter",
 	sizeof(ZipImporter),
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Modules/zlibmodule.c
==============================================================================
--- python/branches/py3k-struni/Modules/zlibmodule.c	(original)
+++ python/branches/py3k-struni/Modules/zlibmodule.c	Sat Jul 21 19:22:18 2007
@@ -961,8 +961,7 @@
 };
 
 static PyTypeObject Comptype = {
-    PyObject_HEAD_INIT(0)
-    0,
+    PyVarObject_HEAD_INIT(0, 0)
     "zlib.Compress",
     sizeof(compobject),
     0,
@@ -978,8 +977,7 @@
 };
 
 static PyTypeObject Decomptype = {
-    PyObject_HEAD_INIT(0)
-    0,
+    PyVarObject_HEAD_INIT(0, 0)
     "zlib.Decompress",
     sizeof(compobject),
     0,
@@ -1013,8 +1011,8 @@
 PyInit_zlib(void)
 {
     PyObject *m, *ver;
-    Comptype.ob_type = &PyType_Type;
-    Decomptype.ob_type = &PyType_Type;
+    Py_Type(&Comptype) = &PyType_Type;
+    Py_Type(&Decomptype) = &PyType_Type;
     m = Py_InitModule4("zlib", zlib_methods,
 		       zlib_module_documentation,
 		       (PyObject*)NULL,PYTHON_API_VERSION);

Modified: python/branches/py3k-struni/Objects/boolobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/boolobject.c	(original)
+++ python/branches/py3k-struni/Objects/boolobject.c	Sat Jul 21 19:22:18 2007
@@ -143,8 +143,7 @@
 /* The type object for bool.  Note that this cannot be subclassed! */
 
 PyTypeObject PyBool_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"bool",
 	sizeof(struct _longobject),
 	0,
@@ -188,11 +187,11 @@
 
 /* Named Zero for link-level compatibility */
 struct _longobject _Py_FalseStruct = {
-	PyObject_HEAD_INIT(&PyBool_Type)
-	0, { 0 }
+	PyVarObject_HEAD_INIT(&PyBool_Type, 0)
+	{ 0 }
 };
 
 struct _longobject _Py_TrueStruct = {
-	PyObject_HEAD_INIT(&PyBool_Type)
-	1, { 1 }
+	PyVarObject_HEAD_INIT(&PyBool_Type, 1)
+	{ 1 }
 };

Modified: python/branches/py3k-struni/Objects/bufferobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/bufferobject.c	(original)
+++ python/branches/py3k-struni/Objects/bufferobject.c	Sat Jul 21 19:22:18 2007
@@ -710,8 +710,7 @@
 };
 
 PyTypeObject PyBuffer_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"buffer",
 	sizeof(PyBufferObject),
 	0,

Modified: python/branches/py3k-struni/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/bytesobject.c	(original)
+++ python/branches/py3k-struni/Objects/bytesobject.c	Sat Jul 21 19:22:18 2007
@@ -25,7 +25,7 @@
     if (nullbytes == NULL)
         return 0;
     nullbytes->ob_bytes = NULL;
-    nullbytes->ob_size = nullbytes->ob_alloc = 0;
+    Py_Size(nullbytes) = nullbytes->ob_alloc = 0;
     return 1;
 }
 
@@ -51,7 +51,7 @@
 Py_ssize_t
 _getbuffer(PyObject *obj, void **ptr)
 {
-    PyBufferProcs *buffer = obj->ob_type->tp_as_buffer;
+    PyBufferProcs *buffer = Py_Type(obj)->tp_as_buffer;
 
     if (buffer == NULL ||
         PyUnicode_Check(obj) ||
@@ -142,7 +142,7 @@
     }
     else if (size < alloc) {
         /* Within allocated size; quick exit */
-        ((PyBytesObject *)self)->ob_size = size;
+        Py_Size(self) = size;
 	((PyBytesObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */
         return 0;
     }
@@ -162,7 +162,7 @@
     }
 
     ((PyBytesObject *)self)->ob_bytes = sval;
-    ((PyBytesObject *)self)->ob_size = size;
+    Py_Size(self) = size;
     ((PyBytesObject *)self)->ob_alloc = alloc;
     ((PyBytesObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */
 
@@ -180,7 +180,7 @@
     bsize = _getbuffer(b, &bptr);
     if (asize < 0 || bsize < 0) {
         PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s",
-                     a->ob_type->tp_name, b->ob_type->tp_name);
+                     Py_Type(a)->tp_name, Py_Type(b)->tp_name);
         return NULL;
     }
 
@@ -201,7 +201,7 @@
 static Py_ssize_t
 bytes_length(PyBytesObject *self)
 {
-    return self->ob_size;
+    return Py_Size(self);
 }
 
 static PyObject *
@@ -222,16 +222,16 @@
     osize = _getbuffer(other, &optr);
     if (osize < 0) {
         PyErr_Format(PyExc_TypeError,
-                     "can't concat bytes to %.100s", other->ob_type->tp_name);
+                     "can't concat bytes to %.100s", Py_Type(other)->tp_name);
         return NULL;
     }
 
-    mysize = self->ob_size;
+    mysize = Py_Size(self);
     size = mysize + osize;
     if (size < 0)
         return PyErr_NoMemory();
     if (size < self->ob_alloc) {
-        self->ob_size = size;
+        Py_Size(self) = size;
 	self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */
     }
     else if (PyBytes_Resize((PyObject *)self, size) < 0)
@@ -250,7 +250,7 @@
 
     if (count < 0)
         count = 0;
-    mysize = self->ob_size;
+    mysize = Py_Size(self);
     size = mysize * count;
     if (count != 0 && size / count != mysize)
         return PyErr_NoMemory();
@@ -275,12 +275,12 @@
 
     if (count < 0)
         count = 0;
-    mysize = self->ob_size;
+    mysize = Py_Size(self);
     size = mysize * count;
     if (count != 0 && size / count != mysize)
         return PyErr_NoMemory();
     if (size < self->ob_alloc) {
-        self->ob_size = size;
+        Py_Size(self) = size;
 	self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */
     }
     else if (PyBytes_Resize((PyObject *)self, size) < 0)
@@ -303,15 +303,15 @@
 {
     Py_ssize_t i;
 
-    if (other->ob_size == 1) {
+    if (Py_Size(other) == 1) {
         return memchr(self->ob_bytes, other->ob_bytes[0],
-                      self->ob_size) != NULL;
+                      Py_Size(self)) != NULL;
     }
-    if (other->ob_size == 0)
+    if (Py_Size(other) == 0)
         return 1; /* Edge case */
-    for (i = 0; i + other->ob_size <= self->ob_size; i++) {
+    for (i = 0; i + Py_Size(other) <= Py_Size(self); i++) {
         /* XXX Yeah, yeah, lots of optimizations possible... */
-        if (memcmp(self->ob_bytes + i, other->ob_bytes, other->ob_size) == 0)
+        if (memcmp(self->ob_bytes + i, other->ob_bytes, Py_Size(other)) == 0)
             return 1;
     }
     return 0;
@@ -333,15 +333,15 @@
         return -1;
     }
 
-    return memchr(self->ob_bytes, ival, self->ob_size) != NULL;
+    return memchr(self->ob_bytes, ival, Py_Size(self)) != NULL;
 }
 
 static PyObject *
 bytes_getitem(PyBytesObject *self, Py_ssize_t i)
 {
     if (i < 0)
-        i += self->ob_size;
-    if (i < 0 || i >= self->ob_size) {
+        i += Py_Size(self);
+    if (i < 0 || i >= Py_Size(self)) {
         PyErr_SetString(PyExc_IndexError, "bytes index out of range");
         return NULL;
     }
@@ -360,7 +360,7 @@
         if (i < 0)
             i += PyBytes_GET_SIZE(self);
 
-        if (i < 0 || i >= self->ob_size) {
+        if (i < 0 || i >= Py_Size(self)) {
             PyErr_SetString(PyExc_IndexError, "bytes index out of range");
             return NULL;
         }
@@ -430,7 +430,7 @@
         if (needed < 0) {
             PyErr_Format(PyExc_TypeError,
                          "can't set bytes slice from %.100s",
-                         values->ob_type->tp_name);
+                         Py_Type(values)->tp_name);
             return -1;
         }
     }
@@ -439,8 +439,8 @@
         lo = 0;
     if (hi < lo)
         hi = lo;
-    if (hi > self->ob_size)
-        hi = self->ob_size;
+    if (hi > Py_Size(self))
+        hi = Py_Size(self);
 
     avail = hi - lo;
     if (avail < 0)
@@ -455,10 +455,10 @@
               0   lo      new_hi              new_size
             */
             memmove(self->ob_bytes + lo + needed, self->ob_bytes + hi,
-                    self->ob_size - hi);
+                    Py_Size(self) - hi);
         }
         if (PyBytes_Resize((PyObject *)self,
-                           self->ob_size + needed - avail) < 0)
+                           Py_Size(self) + needed - avail) < 0)
             return -1;
         if (avail < needed) {
             /*
@@ -468,7 +468,7 @@
               0   lo            new_hi              new_size
              */
             memmove(self->ob_bytes + lo + needed, self->ob_bytes + hi,
-                    self->ob_size - lo - needed);
+                    Py_Size(self) - lo - needed);
         }
     }
 
@@ -484,9 +484,9 @@
     Py_ssize_t ival;
 
     if (i < 0)
-        i += self->ob_size;
+        i += Py_Size(self);
 
-    if (i < 0 || i >= self->ob_size) {
+    if (i < 0 || i >= Py_Size(self)) {
         PyErr_SetString(PyExc_IndexError, "bytes index out of range");
         return -1;
     }
@@ -522,7 +522,7 @@
         if (i < 0)
             i += PyBytes_GET_SIZE(self);
 
-        if (i < 0 || i >= self->ob_size) {
+        if (i < 0 || i >= Py_Size(self)) {
             PyErr_SetString(PyExc_IndexError, "bytes index out of range");
             return -1;
         }
@@ -576,7 +576,7 @@
     else {
         assert(PyBytes_Check(values));
         bytes = ((PyBytesObject *)values)->ob_bytes;
-        needed = ((PyBytesObject *)values)->ob_size;
+        needed = Py_Size(values);
     }
     /* Make sure b[5:2] = ... inserts before 5, not before 2. */
     if ((step < 0 && start < stop) ||
@@ -592,10 +592,10 @@
                   0   lo      new_hi              new_size
                 */
                 memmove(self->ob_bytes + start + needed, self->ob_bytes + stop,
-                        self->ob_size - stop);
+                        Py_Size(self) - stop);
             }
             if (PyBytes_Resize((PyObject *)self,
-                               self->ob_size + needed - slicelen) < 0)
+                               Py_Size(self) + needed - slicelen) < 0)
                 return -1;
             if (slicelen < needed) {
                 /*
@@ -605,7 +605,7 @@
                   0   lo            new_hi              new_size
                  */
                 memmove(self->ob_bytes + start + needed, self->ob_bytes + stop,
-                        self->ob_size - start - needed);
+                        Py_Size(self) - start - needed);
             }
         }
 
@@ -676,7 +676,7 @@
     PyObject *it;
     PyObject *(*iternext)(PyObject *);
 
-    if (self->ob_size != 0) {
+    if (Py_Size(self) != 0) {
         /* Empty previous contents (yes, do this first of all!) */
         if (PyBytes_Resize((PyObject *)self, 0) < 0)
             return -1;
@@ -708,7 +708,7 @@
         if (!PyBytes_Check(encoded) && !PyString_Check(encoded)) {
             PyErr_Format(PyExc_TypeError,
                 "encoder did not return a str8 or bytes object (type=%.400s)",
-                encoded->ob_type->tp_name);
+                Py_Type(encoded)->tp_name);
             Py_DECREF(encoded);
             return -1;
         }
@@ -761,7 +761,7 @@
     it = PyObject_GetIter(arg);
     if (it == NULL)
         return -1;
-    iternext = *it->ob_type->tp_iternext;
+    iternext = *Py_Type(it)->tp_iternext;
 
     /* Run the iterator to exhaustion */
     for (;;) {
@@ -793,11 +793,11 @@
         }
 
         /* Append the byte */
-        if (self->ob_size < self->ob_alloc)
-            self->ob_size++;
-        else if (PyBytes_Resize((PyObject *)self, self->ob_size+1) < 0)
+        if (Py_Size(self) < self->ob_alloc)
+            Py_Size(self)++;
+        else if (PyBytes_Resize((PyObject *)self, Py_Size(self)+1) < 0)
             goto error;
-        self->ob_bytes[self->ob_size-1] = value;
+        self->ob_bytes[Py_Size(self)-1] = value;
     }
 
     /* Clean up and return success */
@@ -818,7 +818,7 @@
     static const char *hexdigits = "0123456789abcdef";
     size_t newsize = 3 + 4 * self->ob_size;
     PyObject *v;
-    if (newsize > PY_SSIZE_T_MAX || newsize / 4 != self->ob_size) {
+    if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(self)) {
         PyErr_SetString(PyExc_OverflowError,
             "bytes object is too large to make repr");
         return NULL;
@@ -836,7 +836,7 @@
         p = PyUnicode_AS_UNICODE(v);
         *p++ = 'b';
         *p++ = quote;
-        for (i = 0; i < self->ob_size; i++) {
+        for (i = 0; i < Py_Size(self); i++) {
             /* There's at least enough room for a hex escape
                and a closing quote. */
             assert(newsize - (p - PyUnicode_AS_UNICODE(v)) >= 5);
@@ -874,7 +874,7 @@
 static PyObject *
 bytes_str(PyBytesObject *self)
 {
-    return PyString_FromStringAndSize(self->ob_bytes, self->ob_size);
+    return PyString_FromStringAndSize(self->ob_bytes, Py_Size(self));
 }
 
 static PyObject *
@@ -941,7 +941,7 @@
     if (self->ob_bytes != 0) {
         PyMem_Free(self->ob_bytes);
     }
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static Py_ssize_t
@@ -956,14 +956,14 @@
         *ptr = "";
     else
         *ptr = self->ob_bytes;
-    return self->ob_size;
+    return Py_Size(self);
 }
 
 static Py_ssize_t
 bytes_getsegcount(PyStringObject *self, Py_ssize_t *lenp)
 {
     if (lenp)
-        *lenp = self->ob_size;
+        *lenp = Py_Size(self);
     return 1;
 }
 
@@ -2043,7 +2043,7 @@
     count++; }
 
 /* Always force the list to the expected size. */
-#define FIX_PREALLOC_SIZE(list) ((PyListObject *)list)->ob_size = count
+#define FIX_PREALLOC_SIZE(list) Py_Size(list) = count
 
 
 Py_LOCAL_INLINE(PyObject *)
@@ -2307,7 +2307,7 @@
 static PyObject *
 bytes_extend(PyBytesObject *self, PyObject *arg)
 {
-    if (bytes_setslice(self, self->ob_size, self->ob_size, arg) == -1)
+    if (bytes_setslice(self, Py_Size(self), Py_Size(self), arg) == -1)
         return NULL;
     Py_RETURN_NONE;
 }
@@ -2321,7 +2321,7 @@
 bytes_reverse(PyBytesObject *self, PyObject *unused)
 {
     char swap, *head, *tail;
-    Py_ssize_t i, j, n = self->ob_size;
+    Py_ssize_t i, j, n = Py_Size(self);
 
     j = n / 2;
     head = self->ob_bytes;
@@ -2343,7 +2343,7 @@
 bytes_insert(PyBytesObject *self, PyObject *args)
 {
     int value;
-    Py_ssize_t where, n = self->ob_size;
+    Py_ssize_t where, n = Py_Size(self);
 
     if (!PyArg_ParseTuple(args, "ni:insert", &where, &value))
         return NULL;
@@ -2382,7 +2382,7 @@
 bytes_append(PyBytesObject *self, PyObject *arg)
 {
     int value;
-    Py_ssize_t n = self->ob_size;
+    Py_ssize_t n = Py_Size(self);
 
     if (! _getbytevalue(arg, &value))
         return NULL;
@@ -2408,7 +2408,7 @@
 bytes_pop(PyBytesObject *self, PyObject *args)
 {
     int value;
-    Py_ssize_t where = -1, n = self->ob_size;
+    Py_ssize_t where = -1, n = Py_Size(self);
 
     if (!PyArg_ParseTuple(args, "|n:pop", &where))
         return NULL;
@@ -2419,8 +2419,8 @@
         return NULL;
     }
     if (where < 0)
-        where += self->ob_size;
-    if (where < 0 || where >= self->ob_size) {
+        where += Py_Size(self);
+    if (where < 0 || where >= Py_Size(self)) {
         PyErr_SetString(PyExc_IndexError, "pop index out of range");
         return NULL;
     }
@@ -2441,7 +2441,7 @@
 bytes_remove(PyBytesObject *self, PyObject *arg)
 {
     int value;
-    Py_ssize_t where, n = self->ob_size;
+    Py_ssize_t where, n = Py_Size(self);
 
     if (! _getbytevalue(arg, &value))
         return NULL;
@@ -2498,9 +2498,9 @@
         return NULL;
     }
     myptr = self->ob_bytes;
-    mysize = self->ob_size;
+    mysize = Py_Size(self);
     argptr = ((PyBytesObject *)arg)->ob_bytes;
-    argsize = ((PyBytesObject *)arg)->ob_size;
+    argsize = Py_Size(arg);
     left = lstrip_helper(myptr, mysize, argptr, argsize);
     right = rstrip_helper(myptr, mysize, argptr, argsize);
     return PyBytes_FromStringAndSize(self->ob_bytes + left, right - left);
@@ -2520,9 +2520,9 @@
         return NULL;
     }
     myptr = self->ob_bytes;
-    mysize = self->ob_size;
+    mysize = Py_Size(self);
     argptr = ((PyBytesObject *)arg)->ob_bytes;
-    argsize = ((PyBytesObject *)arg)->ob_size;
+    argsize = Py_Size(arg);
     left = lstrip_helper(myptr, mysize, argptr, argsize);
     right = mysize;
     return PyBytes_FromStringAndSize(self->ob_bytes + left, right - left);
@@ -2542,9 +2542,9 @@
         return NULL;
     }
     myptr = self->ob_bytes;
-    mysize = self->ob_size;
+    mysize = Py_Size(self);
     argptr = ((PyBytesObject *)arg)->ob_bytes;
-    argsize = ((PyBytesObject *)arg)->ob_size;
+    argsize = Py_Size(arg);
     left = 0;
     right = rstrip_helper(myptr, mysize, argptr, argsize);
     return PyBytes_FromStringAndSize(self->ob_bytes + left, right - left);
@@ -2616,7 +2616,7 @@
                          "can only join an iterable of bytes "
                          "(item %ld has type '%.100s')",
                          /* XXX %ld isn't right on Win64 */
-                         (long)i, obj->ob_type->tp_name);
+                         (long)i, Py_Type(obj)->tp_name);
             goto error;
         }
         if (i > 0)
@@ -2725,7 +2725,7 @@
 bytes_reduce(PyBytesObject *self)
 {
     return Py_BuildValue("(O(s#s))",
-                         self->ob_type,
+                         Py_Type(self),
                          self->ob_bytes == NULL ? "" : self->ob_bytes,
                          self->ob_size,
                          "latin-1");
@@ -2799,8 +2799,7 @@
 If an argument is given it must be an iterable yielding ints in range(256).");
 
 PyTypeObject PyBytes_Type = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "bytes",
     sizeof(PyBytesObject),
     0,

Modified: python/branches/py3k-struni/Objects/cellobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/cellobject.c	(original)
+++ python/branches/py3k-struni/Objects/cellobject.c	Sat Jul 21 19:22:18 2007
@@ -87,8 +87,7 @@
 };
 
 PyTypeObject PyCell_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"cell",
 	sizeof(PyCellObject),
 	0,

Modified: python/branches/py3k-struni/Objects/classobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/classobject.c	(original)
+++ python/branches/py3k-struni/Objects/classobject.c	Sat Jul 21 19:22:18 2007
@@ -426,8 +426,7 @@
 }
 
 PyTypeObject PyMethod_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"method",
 	sizeof(PyMethodObject),
 	0,

Modified: python/branches/py3k-struni/Objects/cobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/cobject.c	(original)
+++ python/branches/py3k-struni/Objects/cobject.c	Sat Jul 21 19:22:18 2007
@@ -135,8 +135,7 @@
 mechanism to link to one another.");
 
 PyTypeObject PyCObject_Type = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,				/*ob_size*/
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "PyCObject",		/*tp_name*/
     sizeof(PyCObject),		/*tp_basicsize*/
     0,				/*tp_itemsize*/

Modified: python/branches/py3k-struni/Objects/codeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/codeobject.c	(original)
+++ python/branches/py3k-struni/Objects/codeobject.c	Sat Jul 21 19:22:18 2007
@@ -390,8 +390,7 @@
 /* XXX code objects need to participate in GC? */
 
 PyTypeObject PyCode_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"code",
 	sizeof(PyCodeObject),
 	0,

Modified: python/branches/py3k-struni/Objects/complexobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/complexobject.c	(original)
+++ python/branches/py3k-struni/Objects/complexobject.c	Sat Jul 21 19:22:18 2007
@@ -1040,8 +1040,7 @@
 };
 
 PyTypeObject PyComplex_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"complex",
 	sizeof(PyComplexObject),
 	0,

Modified: python/branches/py3k-struni/Objects/descrobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/descrobject.c	(original)
+++ python/branches/py3k-struni/Objects/descrobject.c	Sat Jul 21 19:22:18 2007
@@ -384,8 +384,7 @@
 }
 
 static PyTypeObject PyMethodDescr_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"method_descriptor",
 	sizeof(PyMethodDescrObject),
 	0,
@@ -423,8 +422,7 @@
 
 /* This is for METH_CLASS in C, not for "f = classmethod(f)" in Python! */
 static PyTypeObject PyClassMethodDescr_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"classmethod_descriptor",
 	sizeof(PyMethodDescrObject),
 	0,
@@ -461,8 +459,7 @@
 };
 
 static PyTypeObject PyMemberDescr_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"member_descriptor",
 	sizeof(PyMemberDescrObject),
 	0,
@@ -499,8 +496,7 @@
 };
 
 static PyTypeObject PyGetSetDescr_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"getset_descriptor",
 	sizeof(PyGetSetDescrObject),
 	0,
@@ -537,8 +533,7 @@
 };
 
 PyTypeObject PyWrapperDescr_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"wrapper_descriptor",
 	sizeof(PyWrapperDescrObject),
 	0,
@@ -816,8 +811,7 @@
 }
 
 static PyTypeObject proxytype = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dictproxy",				/* tp_name */
 	sizeof(proxyobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -998,8 +992,7 @@
 }
 
 static PyTypeObject wrappertype = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"method-wrapper",			/* tp_name */
 	sizeof(wrapperobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1229,8 +1222,7 @@
 }
 
 PyTypeObject PyProperty_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"property",				/* tp_name */
 	sizeof(propertyobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/dictobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/dictobject.c	(original)
+++ python/branches/py3k-struni/Objects/dictobject.c	Sat Jul 21 19:22:18 2007
@@ -204,7 +204,7 @@
 	if (num_free_dicts) {
 		mp = free_dicts[--num_free_dicts];
 		assert (mp != NULL);
-		assert (mp->ob_type == &PyDict_Type);
+		assert (Py_Type(mp) == &PyDict_Type);
 		_Py_NewReference((PyObject *)mp);
 		if (mp->ma_fill) {
 			EMPTY_TO_MINSIZE(mp);
@@ -879,10 +879,10 @@
 	}
 	if (mp->ma_table != mp->ma_smalltable)
 		PyMem_DEL(mp->ma_table);
-	if (num_free_dicts < MAXFREEDICTS && mp->ob_type == &PyDict_Type)
+	if (num_free_dicts < MAXFREEDICTS && Py_Type(mp) == &PyDict_Type)
 		free_dicts[num_free_dicts++] = mp;
 	else
-		mp->ob_type->tp_free((PyObject *)mp);
+		Py_Type(mp)->tp_free((PyObject *)mp);
 	Py_TRASHCAN_SAFE_END(mp)
 }
 
@@ -1041,7 +1041,7 @@
 			if (missing_str == NULL)
 				missing_str =
 				  PyUnicode_InternFromString("__missing__");
-			missing = _PyType_Lookup(mp->ob_type, missing_str);
+			missing = _PyType_Lookup(Py_Type(mp), missing_str);
 			if (missing != NULL)
 				return PyObject_CallFunctionObjArgs(missing,
 					(PyObject *)mp, key, NULL);
@@ -2024,8 +2024,7 @@
 "    in the keyword argument list.  For example:  dict(one=1, two=2)");
 
 PyTypeObject PyDict_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dict",
 	sizeof(dictobject),
 	0,
@@ -2209,8 +2208,7 @@
 }
 
 PyTypeObject PyDictIterKey_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dictionary-keyiterator",		/* tp_name */
 	sizeof(dictiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2282,8 +2280,7 @@
 }
 
 PyTypeObject PyDictIterValue_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dictionary-valueiterator",		/* tp_name */
 	sizeof(dictiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2369,8 +2366,7 @@
 }
 
 PyTypeObject PyDictIterItem_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dictionary-itemiterator",		/* tp_name */
 	sizeof(dictiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2574,8 +2570,7 @@
 };
 
 PyTypeObject PyDictKeys_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dict_keys",				/* tp_name */
 	sizeof(dictviewobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2659,8 +2654,7 @@
 };
 
 PyTypeObject PyDictItems_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dict_items",				/* tp_name */
 	sizeof(dictviewobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2725,8 +2719,7 @@
 };
 
 PyTypeObject PyDictValues_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"dict_values",				/* tp_name */
 	sizeof(dictviewobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/enumobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/enumobject.c	(original)
+++ python/branches/py3k-struni/Objects/enumobject.c	Sat Jul 21 19:22:18 2007
@@ -43,7 +43,7 @@
 	PyObject_GC_UnTrack(en);
 	Py_XDECREF(en->en_sit);
 	Py_XDECREF(en->en_result);
-	en->ob_type->tp_free(en);
+	Py_Type(en)->tp_free(en);
 }
 
 static int
@@ -68,7 +68,7 @@
 		return NULL;         
 	}
 
-	next_item = (*it->ob_type->tp_iternext)(it);
+	next_item = (*Py_Type(it)->tp_iternext)(it);
 	if (next_item == NULL)
 		return NULL;
 
@@ -105,8 +105,7 @@
 "for obtaining an indexed list: (0, seq[0]), (1, seq[1]), (2, seq[2]), ...");
 
 PyTypeObject PyEnum_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,                              /* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"enumerate",                    /* tp_name */
 	sizeof(enumobject),             /* tp_basicsize */
 	0,                              /* tp_itemsize */
@@ -195,7 +194,7 @@
 {
 	PyObject_GC_UnTrack(ro);
 	Py_XDECREF(ro->seq);
-	ro->ob_type->tp_free(ro);
+	Py_Type(ro)->tp_free(ro);
 }
 
 static int
@@ -253,8 +252,7 @@
 };
 
 PyTypeObject PyReversed_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,                              /* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"reversed",                     /* tp_name */
 	sizeof(reversedobject),         /* tp_basicsize */
 	0,                              /* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/exceptions.c
==============================================================================
--- python/branches/py3k-struni/Objects/exceptions.c	(original)
+++ python/branches/py3k-struni/Objects/exceptions.c	Sat Jul 21 19:22:18 2007
@@ -41,7 +41,7 @@
 static int
 BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
 {
-    if (!_PyArg_NoKeywords(self->ob_type->tp_name, kwds))
+    if (!_PyArg_NoKeywords(Py_Type(self)->tp_name, kwds))
         return -1;
 
     Py_DECREF(self->args);
@@ -64,7 +64,7 @@
 {
     _PyObject_GC_UNTRACK(self);
     BaseException_clear(self);
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static int
@@ -94,7 +94,7 @@
     char *name;
     char *dot;
 
-    name = (char *)self->ob_type->tp_name;
+    name = (char *)Py_Type(self)->tp_name;
     dot = strrchr(name, '.');
     if (dot != NULL) name = dot+1;
 
@@ -106,9 +106,9 @@
 BaseException_reduce(PyBaseExceptionObject *self)
 {
     if (self->args && self->dict)
-        return PyTuple_Pack(3, self->ob_type, self->args, self->dict);
+        return PyTuple_Pack(3, Py_Type(self), self->args, self->dict);
     else
-        return PyTuple_Pack(2, self->ob_type, self->args);
+        return PyTuple_Pack(2, Py_Type(self), self->args);
 }
 
 /*
@@ -207,8 +207,7 @@
 
 
 static PyTypeObject _PyExc_BaseException = {
-    PyObject_HEAD_INIT(NULL)
-    0,                          /*ob_size*/
+    PyVarObject_HEAD_INIT(NULL, 0)
     "BaseException", /*tp_name*/
     sizeof(PyBaseExceptionObject), /*tp_basicsize*/
     0,                          /*tp_itemsize*/
@@ -258,8 +257,7 @@
  */
 #define SimpleExtendsException(EXCBASE, EXCNAME, EXCDOC) \
 static PyTypeObject _PyExc_ ## EXCNAME = { \
-    PyObject_HEAD_INIT(NULL) \
-    0, \
+    PyVarObject_HEAD_INIT(NULL, 0) \
     # EXCNAME, \
     sizeof(PyBaseExceptionObject), \
     0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \
@@ -274,8 +272,7 @@
 
 #define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
 static PyTypeObject _PyExc_ ## EXCNAME = { \
-    PyObject_HEAD_INIT(NULL) \
-    0, \
+    PyVarObject_HEAD_INIT(NULL, 0) \
     # EXCNAME, \
     sizeof(Py ## EXCSTORE ## Object), \
     0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
@@ -290,8 +287,7 @@
 
 #define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDEALLOC, EXCMETHODS, EXCMEMBERS, EXCSTR, EXCDOC) \
 static PyTypeObject _PyExc_ ## EXCNAME = { \
-    PyObject_HEAD_INIT(NULL) \
-    0, \
+    PyVarObject_HEAD_INIT(NULL, 0) \
     # EXCNAME, \
     sizeof(Py ## EXCSTORE ## Object), 0, \
     (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
@@ -369,7 +365,7 @@
 {
     _PyObject_GC_UNTRACK(self);
     SystemExit_clear(self);
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static int
@@ -474,7 +470,7 @@
 {
     _PyObject_GC_UNTRACK(self);
     EnvironmentError_clear(self);
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static int
@@ -540,9 +536,9 @@
         Py_INCREF(args);
 
     if (self->dict)
-        res = PyTuple_Pack(3, self->ob_type, args, self->dict);
+        res = PyTuple_Pack(3, Py_Type(self), args, self->dict);
     else
-        res = PyTuple_Pack(2, self->ob_type, args);
+        res = PyTuple_Pack(2, Py_Type(self), args);
     Py_DECREF(args);
     return res;
 }
@@ -595,7 +591,7 @@
 {
     _PyObject_GC_UNTRACK(self);
     WindowsError_clear(self);
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static int
@@ -793,7 +789,7 @@
 {
     _PyObject_GC_UNTRACK(self);
     SyntaxError_clear(self);
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static int
@@ -1244,7 +1240,7 @@
 {
     _PyObject_GC_UNTRACK(self);
     UnicodeError_clear(self);
-    self->ob_type->tp_free((PyObject *)self);
+    Py_Type(self)->tp_free((PyObject *)self);
 }
 
 static int
@@ -1316,8 +1312,7 @@
 }
 
 static PyTypeObject _PyExc_UnicodeEncodeError = {
-    PyObject_HEAD_INIT(NULL)
-    0,
+    PyVarObject_HEAD_INIT(NULL, 0)
     "UnicodeEncodeError",
     sizeof(PyUnicodeErrorObject), 0,
     (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1378,8 +1373,7 @@
 }
 
 static PyTypeObject _PyExc_UnicodeDecodeError = {
-    PyObject_HEAD_INIT(NULL)
-    0,
+    PyVarObject_HEAD_INIT(NULL, 0)
     "UnicodeDecodeError",
     sizeof(PyUnicodeErrorObject), 0,
     (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1465,8 +1459,7 @@
 }
 
 static PyTypeObject _PyExc_UnicodeTranslateError = {
-    PyObject_HEAD_INIT(NULL)
-    0,
+    PyVarObject_HEAD_INIT(NULL, 0)
     "UnicodeTranslateError",
     sizeof(PyUnicodeErrorObject), 0,
     (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

Modified: python/branches/py3k-struni/Objects/floatobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/floatobject.c	(original)
+++ python/branches/py3k-struni/Objects/floatobject.c	Sat Jul 21 19:22:18 2007
@@ -41,8 +41,8 @@
 	p = &((PyFloatBlock *)p)->objects[0];
 	q = p + N_FLOATOBJECTS;
 	while (--q > p)
-		q->ob_type = (struct _typeobject *)(q-1);
-	q->ob_type = NULL;
+		Py_Type(q) = (struct _typeobject *)(q-1);
+	Py_Type(q) = NULL;
 	return p + N_FLOATOBJECTS - 1;
 }
 
@@ -56,7 +56,7 @@
 	}
 	/* Inline PyObject_New */
 	op = free_list;
-	free_list = (PyFloatObject *)op->ob_type;
+	free_list = (PyFloatObject *)Py_Type(op);
 	PyObject_INIT(op, &PyFloat_Type);
 	op->ob_fval = fval;
 	return (PyObject *) op;
@@ -156,11 +156,11 @@
 float_dealloc(PyFloatObject *op)
 {
 	if (PyFloat_CheckExact(op)) {
-		op->ob_type = (struct _typeobject *)free_list;
+		Py_Type(op) = (struct _typeobject *)free_list;
 		free_list = op;
 	}
 	else
-		op->ob_type->tp_free((PyObject *)op);
+		Py_Type(op)->tp_free((PyObject *)op);
 }
 
 double
@@ -178,7 +178,7 @@
 		return -1;
 	}
 
-	if ((nb = op->ob_type->tp_as_number) == NULL || nb->nb_float == NULL) {
+	if ((nb = Py_Type(op)->tp_as_number) == NULL || nb->nb_float == NULL) {
 		PyErr_SetString(PyExc_TypeError, "a float is required");
 		return -1;
 	}
@@ -880,7 +880,7 @@
 	if (!PyString_Check(arg)) {
 		PyErr_Format(PyExc_TypeError,
 	     "__getformat__() argument must be string, not %.500s",
-			     arg->ob_type->tp_name);
+			     Py_Type(arg)->tp_name);
 		return NULL;
 	}
 	s = PyString_AS_STRING(arg);
@@ -1044,8 +1044,7 @@
 };
 
 PyTypeObject PyFloat_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"float",
 	sizeof(PyFloatObject),
 	0,
@@ -1156,7 +1155,7 @@
 		for (i = 0, p = &list->objects[0];
 		     i < N_FLOATOBJECTS;
 		     i++, p++) {
-			if (PyFloat_CheckExact(p) && p->ob_refcnt != 0)
+			if (PyFloat_CheckExact(p) && Py_Refcnt(p) != 0)
 				frem++;
 		}
 		next = list->next;
@@ -1167,8 +1166,8 @@
 			     i < N_FLOATOBJECTS;
 			     i++, p++) {
 				if (!PyFloat_CheckExact(p) ||
-				    p->ob_refcnt == 0) {
-					p->ob_type = (struct _typeobject *)
+				    Py_Refcnt(p) == 0) {
+					Py_Type(p) = (struct _typeobject *)
 						free_list;
 					free_list = p;
 				}
@@ -1200,7 +1199,7 @@
 			     i < N_FLOATOBJECTS;
 			     i++, p++) {
 				if (PyFloat_CheckExact(p) &&
-				    p->ob_refcnt != 0) {
+				    Py_Refcnt(p) != 0) {
 					char buf[100];
 					format_float(buf, sizeof(buf), p, PREC_STR);
 					/* XXX(twouters) cast refcount to
@@ -1209,7 +1208,7 @@
 					 */
 					fprintf(stderr,
 			     "#   <float at %p, refcnt=%ld, val=%s>\n",
-						p, (long)p->ob_refcnt, buf);
+						p, (long)Py_Refcnt(p), buf);
 				}
 			}
 			list = list->next;

Modified: python/branches/py3k-struni/Objects/frameobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/frameobject.c	(original)
+++ python/branches/py3k-struni/Objects/frameobject.c	Sat Jul 21 19:22:18 2007
@@ -503,8 +503,7 @@
 
 
 PyTypeObject PyFrame_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"frame",
 	sizeof(PyFrameObject),
 	sizeof(PyObject *),
@@ -617,7 +616,7 @@
 		    --numfree;
 		    f = free_list;
 		    free_list = free_list->f_back;
-		    if (f->ob_size < extras) {
+		    if (Py_Size(f) < extras) {
 			    f = PyObject_GC_Resize(PyFrameObject, f, extras);
 			    if (f == NULL) {
 				    Py_DECREF(builtins);

Modified: python/branches/py3k-struni/Objects/funcobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/funcobject.c	(original)
+++ python/branches/py3k-struni/Objects/funcobject.c	Sat Jul 21 19:22:18 2007
@@ -655,8 +655,7 @@
 }
 
 PyTypeObject PyFunction_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"function",
 	sizeof(PyFunctionObject),
 	0,
@@ -726,7 +725,7 @@
 {
 	_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
@@ -755,9 +754,9 @@
 		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
@@ -803,8 +802,7 @@
 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,
@@ -884,7 +882,7 @@
 {
 	_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
@@ -951,8 +949,7 @@
 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,

Modified: python/branches/py3k-struni/Objects/genobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/genobject.c	(original)
+++ python/branches/py3k-struni/Objects/genobject.c	Sat Jul 21 19:22:18 2007
@@ -28,7 +28,7 @@
 
 	if (gen->gi_frame != NULL && gen->gi_frame->f_stacktop != NULL) {
 		/* Generator is paused, so we need to close */
-		gen->ob_type->tp_del(self);
+		Py_Type(gen)->tp_del(self);
 		if (self->ob_refcnt > 0)
 			return;		/* resurrected.  :( */
 	}
@@ -295,8 +295,7 @@
 };
 
 PyTypeObject PyGen_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"generator",				/* tp_name */
 	sizeof(PyGenObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/intobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/intobject.c	(original)
+++ python/branches/py3k-struni/Objects/intobject.c	Sat Jul 21 19:22:18 2007
@@ -57,8 +57,8 @@
 	p = &((PyIntBlock *)p)->objects[0];
 	q = p + N_INTOBJECTS;
 	while (--q > p)
-		q->ob_type = (struct _typeobject *)(q-1);
-	q->ob_type = NULL;
+		Py_Type(q) = (struct _typeobject *)(q-1);
+	Py_Type(q) = NULL;
 	return p + N_INTOBJECTS - 1;
 }
 
@@ -103,7 +103,7 @@
 	}
 	/* Inline PyObject_New */
 	v = free_list;
-	free_list = (PyIntObject *)v->ob_type;
+	free_list = (PyIntObject *)Py_Type(v);
 	PyObject_INIT(v, &PyInt_Type);
 	v->ob_ival = ival;
 	return (PyObject *) v;
@@ -129,17 +129,17 @@
 int_dealloc(PyIntObject *v)
 {
 	if (PyInt_CheckExact(v)) {
-		v->ob_type = (struct _typeobject *)free_list;
+		Py_Type(v) = (struct _typeobject *)free_list;
 		free_list = v;
 	}
 	else
-		v->ob_type->tp_free((PyObject *)v);
+		Py_Type(v)->tp_free((PyObject *)v);
 }
 
 static void
 int_free(PyIntObject *v)
 {
-	v->ob_type = (struct _typeobject *)free_list;
+	Py_Type(v) = (struct _typeobject *)free_list;
 	free_list = v;
 }
 
@@ -153,7 +153,7 @@
 	if (op && PyInt_Check(op))
 		return PyInt_AS_LONG((PyIntObject*) op);
 
-	if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL ||
+	if (op == NULL || (nb = Py_Type(op)->tp_as_number) == NULL ||
 	    nb->nb_int == NULL) {
 		PyErr_SetString(PyExc_TypeError, "an integer is required");
 		return -1;
@@ -208,7 +208,7 @@
 	return PyInt_AsLong(op);
 #else
 
-	if ((nb = op->ob_type->tp_as_number) == NULL ||
+	if ((nb = Py_Type(op)->tp_as_number) == NULL ||
 	    (nb->nb_int == NULL && nb->nb_long == 0)) {
 		PyErr_SetString(PyExc_TypeError, "an integer is required");
 		return -1;
@@ -257,7 +257,7 @@
 	if (op && PyLong_Check(op))
 		return PyLong_AsUnsignedLongMask(op);
 
-	if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL ||
+	if (op == NULL || (nb = Py_Type(op)->tp_as_number) == NULL ||
 	    nb->nb_int == NULL) {
 		PyErr_SetString(PyExc_TypeError, "an integer is required");
 		return (unsigned long)-1;
@@ -302,7 +302,7 @@
 	if (op && PyLong_Check(op))
 		return PyLong_AsUnsignedLongLongMask(op);
 
-	if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL ||
+	if (op == NULL || (nb = Py_Type(op)->tp_as_number) == NULL ||
 	    nb->nb_int == NULL) {
 		PyErr_SetString(PyExc_TypeError, "an integer is required");
 		return (unsigned PY_LONG_LONG)-1;
@@ -1062,8 +1062,7 @@
 };
 
 PyTypeObject PyInt_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"int",
 	sizeof(PyIntObject),
 	0,
@@ -1116,7 +1115,7 @@
 			return 0;
 		/* PyObject_New is inlined */
 		v = free_list;
-		free_list = (PyIntObject *)v->ob_type;
+		free_list = (PyIntObject *)Py_Type(v);
 		PyObject_INIT(v, &PyInt_Type);
 		v->ob_ival = ival;
 		small_ints[ival + NSMALLNEGINTS] = v;
@@ -1169,7 +1168,7 @@
 			     ctr++, p++) {
 				if (!PyInt_CheckExact(p) ||
 				    p->ob_refcnt == 0) {
-					p->ob_type = (struct _typeobject *)
+					Py_Type(p) = (struct _typeobject *)
 						free_list;
 					free_list = p;
 				}

Modified: python/branches/py3k-struni/Objects/iterobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/iterobject.c	(original)
+++ python/branches/py3k-struni/Objects/iterobject.c	Sat Jul 21 19:22:18 2007
@@ -94,8 +94,7 @@
 };
 
 PyTypeObject PySeqIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"iterator",				/* tp_name */
 	sizeof(seqiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -199,8 +198,7 @@
 }
 
 PyTypeObject PyCallIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"callable-iterator",			/* tp_name */
 	sizeof(calliterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -255,7 +253,7 @@
         
         assert(PyTuple_Check(args));
 
-	if (PyZipIter_Type.ob_type == NULL) {
+	if (Py_Type(&PyZipIter_Type) == NULL) {
 		if (PyType_Ready(&PyZipIter_Type) < 0)
 			return NULL;
 	}
@@ -370,8 +368,7 @@
 }
 
 static PyTypeObject PyZipIter_Type = {
-	PyObject_HEAD_INIT(0)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(0, 0)
 	"zipiterator",				/* tp_name */
 	sizeof(zipiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/listobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/listobject.c	(original)
+++ python/branches/py3k-struni/Objects/listobject.c	Sat Jul 21 19:22:18 2007
@@ -34,7 +34,7 @@
 	*/
 	if (allocated >= newsize && newsize >= (allocated >> 1)) {
 		assert(self->ob_item != NULL || newsize == 0);
-		self->ob_size = newsize;
+		Py_Size(self) = newsize;
 		return 0;
 	}
 
@@ -58,7 +58,7 @@
 		return -1;
 	}
 	self->ob_item = items;
-	self->ob_size = newsize;
+	Py_Size(self) = newsize;
 	self->allocated = new_allocated;
 	return 0;
 }
@@ -114,7 +114,7 @@
 		}
 		memset(op->ob_item, 0, nbytes);
 	}
-	op->ob_size = size;
+	Py_Size(op) = size;
 	op->allocated = size;
 	_PyObject_GC_TRACK(op);
 	return (PyObject *) op;
@@ -128,7 +128,7 @@
 		return -1;
 	}
 	else
-		return ((PyListObject *)op) -> ob_size;
+		return Py_Size(op);
 }
 
 static PyObject *indexerr = NULL;
@@ -140,7 +140,7 @@
 		PyErr_BadInternalCall();
 		return NULL;
 	}
-	if (i < 0 || i >= ((PyListObject *)op) -> ob_size) {
+	if (i < 0 || i >= Py_Size(op)) {
 		if (indexerr == NULL)
 			indexerr = PyString_FromString(
 				"list index out of range");
@@ -161,7 +161,7 @@
 		PyErr_BadInternalCall();
 		return -1;
 	}
-	if (i < 0 || i >= ((PyListObject *)op) -> ob_size) {
+	if (i < 0 || i >= Py_Size(op)) {
 		Py_XDECREF(newitem);
 		PyErr_SetString(PyExc_IndexError,
 				"list assignment index out of range");
@@ -177,7 +177,7 @@
 static int
 ins1(PyListObject *self, Py_ssize_t where, PyObject *v)
 {
-	Py_ssize_t i, n = self->ob_size;
+	Py_ssize_t i, n = Py_Size(self);
 	PyObject **items;
 	if (v == NULL) {
 		PyErr_BadInternalCall();
@@ -259,7 +259,7 @@
 		   There's a simple test case where somehow this reduces
 		   thrashing when a *very* large list is created and
 		   immediately deleted. */
-		i = op->ob_size;
+		i = Py_Size(op);
 		while (--i >= 0) {
 			Py_XDECREF(op->ob_item[i]);
 		}
@@ -268,7 +268,7 @@
 	if (num_free_lists < MAXFREELISTS && PyList_CheckExact(op))
 		free_lists[num_free_lists++] = op;
 	else
-		op->ob_type->tp_free((PyObject *)op);
+		Py_Type(op)->tp_free((PyObject *)op);
 	Py_TRASHCAN_SAFE_END(op)
 }
 
@@ -286,7 +286,7 @@
 		return 0;
 	}
 	fprintf(fp, "[");
-	for (i = 0; i < op->ob_size; i++) {
+	for (i = 0; i < Py_Size(op); i++) {
 		if (i > 0)
 			fprintf(fp, ", ");
 		if (PyObject_Print(op->ob_item[i], fp, 0) != 0) {
@@ -311,7 +311,7 @@
 		return i > 0 ? PyUnicode_FromString("[...]") : NULL;
 	}
 
-	if (v->ob_size == 0) {
+	if (Py_Size(v) == 0) {
 		result = PyUnicode_FromString("[]");
 		goto Done;
 	}
@@ -322,7 +322,7 @@
 
 	/* Do repr() on each element.  Note that this may mutate the list,
 	   so must refetch the list size on each iteration. */
-	for (i = 0; i < v->ob_size; ++i) {
+	for (i = 0; i < Py_Size(v); ++i) {
 		int status;
 		s = PyObject_Repr(v->ob_item[i]);
 		if (s == NULL)
@@ -369,7 +369,7 @@
 static Py_ssize_t
 list_length(PyListObject *a)
 {
-	return a->ob_size;
+	return Py_Size(a);
 }
 
 static int
@@ -378,7 +378,7 @@
 	Py_ssize_t i;
 	int cmp;
 
-	for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i)
+	for (i = 0, cmp = 0 ; cmp == 0 && i < Py_Size(a); ++i)
 		cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i),
 						   Py_EQ);
 	return cmp;
@@ -387,7 +387,7 @@
 static PyObject *
 list_item(PyListObject *a, Py_ssize_t i)
 {
-	if (i < 0 || i >= a->ob_size) {
+	if (i < 0 || i >= Py_Size(a)) {
 		if (indexerr == NULL)
 			indexerr = PyString_FromString(
 				"list index out of range");
@@ -406,12 +406,12 @@
 	Py_ssize_t i, len;
 	if (ilow < 0)
 		ilow = 0;
-	else if (ilow > a->ob_size)
-		ilow = a->ob_size;
+	else if (ilow > Py_Size(a))
+		ilow = Py_Size(a);
 	if (ihigh < ilow)
 		ihigh = ilow;
-	else if (ihigh > a->ob_size)
-		ihigh = a->ob_size;
+	else if (ihigh > Py_Size(a))
+		ihigh = Py_Size(a);
 	len = ihigh - ilow;
 	np = (PyListObject *) PyList_New(len);
 	if (np == NULL)
@@ -451,7 +451,7 @@
 		return NULL;
 	}
 #define b ((PyListObject *)bb)
-	size = a->ob_size + b->ob_size;
+	size = Py_Size(a) + Py_Size(b);
 	if (size < 0)
 		return PyErr_NoMemory();
 	np = (PyListObject *) PyList_New(size);
@@ -460,14 +460,14 @@
 	}
 	src = a->ob_item;
 	dest = np->ob_item;
-	for (i = 0; i < a->ob_size; i++) {
+	for (i = 0; i < Py_Size(a); i++) {
 		PyObject *v = src[i];
 		Py_INCREF(v);
 		dest[i] = v;
 	}
 	src = b->ob_item;
-	dest = np->ob_item + a->ob_size;
-	for (i = 0; i < b->ob_size; i++) {
+	dest = np->ob_item + Py_Size(a);
+	for (i = 0; i < Py_Size(b); i++) {
 		PyObject *v = src[i];
 		Py_INCREF(v);
 		dest[i] = v;
@@ -486,17 +486,17 @@
 	PyObject *elem;
 	if (n < 0)
 		n = 0;
-	size = a->ob_size * n;
+	size = Py_Size(a) * n;
 	if (size == 0)
               return PyList_New(0);
-	if (n && size/n != a->ob_size)
+	if (n && size/n != Py_Size(a))
 		return PyErr_NoMemory();
 	np = (PyListObject *) PyList_New(size);
 	if (np == NULL)
 		return NULL;
 
 	items = np->ob_item;
-	if (a->ob_size == 1) {
+	if (Py_Size(a) == 1) {
 		elem = a->ob_item[0];
 		for (i = 0; i < n; i++) {
 			items[i] = elem;
@@ -507,7 +507,7 @@
 	p = np->ob_item;
 	items = a->ob_item;
 	for (i = 0; i < n; i++) {
-		for (j = 0; j < a->ob_size; j++) {
+		for (j = 0; j < Py_Size(a); j++) {
 			*p = items[j];
 			Py_INCREF(*p);
 			p++;
@@ -524,8 +524,8 @@
 	if (item != NULL) {
 		/* Because XDECREF can recursively invoke operations on
 		   this list, we make it empty first. */
-		i = a->ob_size;
-		a->ob_size = 0;
+		i = Py_Size(a);
+		Py_Size(a) = 0;
 		a->ob_item = NULL;
 		a->allocated = 0;
 		while (--i >= 0) {
@@ -571,7 +571,7 @@
 	else {
 		if (a == b) {
 			/* Special case "a[i:j] = a" -- copy b first */
-			v = list_slice(b, 0, b->ob_size);
+			v = list_slice(b, 0, Py_Size(b));
 			if (v == NULL)
 				return result;
 			result = list_ass_slice(a, ilow, ihigh, v);
@@ -586,18 +586,18 @@
 	}
 	if (ilow < 0)
 		ilow = 0;
-	else if (ilow > a->ob_size)
-		ilow = a->ob_size;
+	else if (ilow > Py_Size(a))
+		ilow = Py_Size(a);
 
 	if (ihigh < ilow)
 		ihigh = ilow;
-	else if (ihigh > a->ob_size)
-		ihigh = a->ob_size;
+	else if (ihigh > Py_Size(a))
+		ihigh = Py_Size(a);
 
 	norig = ihigh - ilow;
 	assert(norig >= 0);
 	d = n - norig;
-	if (a->ob_size + d == 0) {
+	if (Py_Size(a) + d == 0) {
 		Py_XDECREF(v_as_SF);
 		return list_clear(a);
 	}
@@ -615,12 +615,12 @@
 
 	if (d < 0) { /* Delete -d items */
 		memmove(&item[ihigh+d], &item[ihigh],
-			(a->ob_size - ihigh)*sizeof(PyObject *));
-		list_resize(a, a->ob_size + d);
+			(Py_Size(a) - ihigh)*sizeof(PyObject *));
+		list_resize(a, Py_Size(a) + d);
 		item = a->ob_item;
 	}
 	else if (d > 0) { /* Insert d items */
-		k = a->ob_size;
+		k = Py_Size(a);
 		if (list_resize(a, k+d) < 0)
 			goto Error;
 		item = a->ob_item;
@@ -692,7 +692,7 @@
 list_ass_item(PyListObject *a, Py_ssize_t i, PyObject *v)
 {
 	PyObject *old_value;
-	if (i < 0 || i >= a->ob_size) {
+	if (i < 0 || i >= Py_Size(a)) {
 		PyErr_SetString(PyExc_IndexError,
 				"list assignment index out of range");
 		return -1;
@@ -751,7 +751,7 @@
 			Py_DECREF(b);
 			Py_RETURN_NONE;
 		}
-		m = self->ob_size;
+		m = Py_Size(self);
 		if (list_resize(self, m + n) == -1) {
 			Py_DECREF(b);
 			return NULL;
@@ -789,14 +789,14 @@
 		PyErr_Clear();
 		n = 8;	/* arbitrary */
 	}
-	m = self->ob_size;
+	m = Py_Size(self);
 	mn = m + n;
 	if (mn >= m) {
 		/* Make room. */
 		if (list_resize(self, mn) == -1)
 			goto error;
 		/* Make the list sane again. */
-		self->ob_size = m;
+		Py_Size(self) = m;
 	}
 	/* Else m + n overflowed; on the chance that n lied, and there really
 	 * is enough room, ignore it.  If n was telling the truth, we'll
@@ -815,10 +815,10 @@
 			}
 			break;
 		}
-		if (self->ob_size < self->allocated) {
+		if (Py_Size(self) < self->allocated) {
 			/* steals ref */
-			PyList_SET_ITEM(self, self->ob_size, item);
-			++self->ob_size;
+			PyList_SET_ITEM(self, Py_Size(self), item);
+			++Py_Size(self);
 		}
 		else {
 			int status = app1(self, item);
@@ -829,8 +829,8 @@
 	}
 
 	/* Cut back result list if initial guess was too large. */
-	if (self->ob_size < self->allocated)
-		list_resize(self, self->ob_size);  /* shrinking can't fail */
+	if (Py_Size(self) < self->allocated)
+		list_resize(self, Py_Size(self));  /* shrinking can't fail */
 
 	Py_DECREF(it);
 	Py_RETURN_NONE;
@@ -869,20 +869,20 @@
 	if (!PyArg_ParseTuple(args, "|n:pop", &i))
 		return NULL;
 
-	if (self->ob_size == 0) {
+	if (Py_Size(self) == 0) {
 		/* Special-case most common failure cause */
 		PyErr_SetString(PyExc_IndexError, "pop from empty list");
 		return NULL;
 	}
 	if (i < 0)
-		i += self->ob_size;
-	if (i < 0 || i >= self->ob_size) {
+		i += Py_Size(self);
+	if (i < 0 || i >= Py_Size(self)) {
 		PyErr_SetString(PyExc_IndexError, "pop index out of range");
 		return NULL;
 	}
 	v = self->ob_item[i];
-	if (i == self->ob_size - 1) {
-		status = list_resize(self, self->ob_size - 1);
+	if (i == Py_Size(self) - 1) {
+		status = list_resize(self, Py_Size(self) - 1);
 		assert(status >= 0);
 		return v; /* and v now owns the reference the list had */
 	}
@@ -1812,8 +1812,7 @@
 sortwrapper_dealloc(sortwrapperobject *);
 
 static PyTypeObject sortwrapper_type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"sortwrapper",				/* tp_name */
 	sizeof(sortwrapperobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1929,8 +1928,7 @@
 PyDoc_STRVAR(cmpwrapper_doc, "cmp() wrapper for sort with custom keys.");
 
 static PyTypeObject cmpwrapper_type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"cmpwrapper",				/* tp_name */
 	sizeof(cmpwrapperobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2033,10 +2031,10 @@
 	 * sorting (allowing mutations during sorting is a core-dump
 	 * factory, since ob_item may change).
 	 */
-	saved_ob_size = self->ob_size;
+	saved_ob_size = Py_Size(self);
 	saved_ob_item = self->ob_item;
 	saved_allocated = self->allocated;
-	self->ob_size = 0;
+	Py_Size(self) = 0;
 	self->ob_item = NULL;
 	self->allocated = -1; /* any operation will reset it to >= 0 */
 
@@ -2142,8 +2140,8 @@
 
 dsu_fail:
 	final_ob_item = self->ob_item;
-	i = self->ob_size;
-	self->ob_size = saved_ob_size;
+	i = Py_Size(self);
+	Py_Size(self) = saved_ob_size;
 	self->ob_item = saved_ob_item;
 	self->allocated = saved_allocated;
 	if (final_ob_item != NULL) {
@@ -2178,8 +2176,8 @@
 static PyObject *
 listreverse(PyListObject *self)
 {
-	if (self->ob_size > 1)
-		reverse_slice(self->ob_item, self->ob_item + self->ob_size);
+	if (Py_Size(self) > 1)
+		reverse_slice(self->ob_item, self->ob_item + Py_Size(self));
 	Py_RETURN_NONE;
 }
 
@@ -2192,8 +2190,8 @@
 		PyErr_BadInternalCall();
 		return -1;
 	}
-	if (self->ob_size > 1)
-		reverse_slice(self->ob_item, self->ob_item + self->ob_size);
+	if (Py_Size(self) > 1)
+		reverse_slice(self->ob_item, self->ob_item + Py_Size(self));
 	return 0;
 }
 
@@ -2207,7 +2205,7 @@
 		PyErr_BadInternalCall();
 		return NULL;
 	}
-	n = ((PyListObject *)v)->ob_size;
+	n = Py_Size(v);
 	w = PyTuple_New(n);
 	if (w == NULL)
 		return NULL;
@@ -2225,7 +2223,7 @@
 static PyObject *
 listindex(PyListObject *self, PyObject *args)
 {
-	Py_ssize_t i, start=0, stop=self->ob_size;
+	Py_ssize_t i, start=0, stop=Py_Size(self);
 	PyObject *v;
 
 	if (!PyArg_ParseTuple(args, "O|O&O&:index", &v,
@@ -2233,16 +2231,16 @@
 	                            _PyEval_SliceIndex, &stop))
 		return NULL;
 	if (start < 0) {
-		start += self->ob_size;
+		start += Py_Size(self);
 		if (start < 0)
 			start = 0;
 	}
 	if (stop < 0) {
-		stop += self->ob_size;
+		stop += Py_Size(self);
 		if (stop < 0)
 			stop = 0;
 	}
-	for (i = start; i < stop && i < self->ob_size; i++) {
+	for (i = start; i < stop && i < Py_Size(self); i++) {
 		int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
 		if (cmp > 0)
 			return PyInt_FromSsize_t(i);
@@ -2259,7 +2257,7 @@
 	Py_ssize_t count = 0;
 	Py_ssize_t i;
 
-	for (i = 0; i < self->ob_size; i++) {
+	for (i = 0; i < Py_Size(self); i++) {
 		int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
 		if (cmp > 0)
 			count++;
@@ -2274,7 +2272,7 @@
 {
 	Py_ssize_t i;
 
-	for (i = 0; i < self->ob_size; i++) {
+	for (i = 0; i < Py_Size(self); i++) {
 		int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
 		if (cmp > 0) {
 			if (list_ass_slice(self, i, i+1,
@@ -2294,7 +2292,7 @@
 {
 	Py_ssize_t i;
 
-	for (i = o->ob_size; --i >= 0; )
+	for (i = Py_Size(o); --i >= 0; )
 		Py_VISIT(o->ob_item[i]);
 	return 0;
 }
@@ -2313,7 +2311,7 @@
 	vl = (PyListObject *)v;
 	wl = (PyListObject *)w;
 
-	if (vl->ob_size != wl->ob_size && (op == Py_EQ || op == Py_NE)) {
+	if (Py_Size(vl) != Py_Size(wl) && (op == Py_EQ || op == Py_NE)) {
 		/* Shortcut: if the lengths differ, the lists differ */
 		PyObject *res;
 		if (op == Py_EQ)
@@ -2325,7 +2323,7 @@
 	}
 
 	/* Search for the first index where items are different */
-	for (i = 0; i < vl->ob_size && i < wl->ob_size; i++) {
+	for (i = 0; i < Py_Size(vl) && i < Py_Size(wl); i++) {
 		int k = PyObject_RichCompareBool(vl->ob_item[i],
 						 wl->ob_item[i], Py_EQ);
 		if (k < 0)
@@ -2334,10 +2332,10 @@
 			break;
 	}
 
-	if (i >= vl->ob_size || i >= wl->ob_size) {
+	if (i >= Py_Size(vl) || i >= Py_Size(wl)) {
 		/* No more items to compare -- compare sizes */
-		Py_ssize_t vs = vl->ob_size;
-		Py_ssize_t ws = wl->ob_size;
+		Py_ssize_t vs = Py_Size(vl);
+		Py_ssize_t ws = Py_Size(wl);
 		int cmp;
 		PyObject *res;
 		switch (op) {
@@ -2381,8 +2379,8 @@
 		return -1;
 
 	/* Verify list invariants established by PyType_GenericAlloc() */
-	assert(0 <= self->ob_size);
-	assert(self->ob_size <= self->allocated || self->allocated == -1);
+	assert(0 <= Py_Size(self));
+	assert(Py_Size(self) <= self->allocated || self->allocated == -1);
 	assert(self->ob_item != NULL ||
 	       self->allocated == 0 || self->allocated == -1);
 
@@ -2478,7 +2476,7 @@
 		PyObject* it;
 		PyObject **src, **dest;
 
-		if (PySlice_GetIndicesEx((PySliceObject*)item, self->ob_size,
+		if (PySlice_GetIndicesEx((PySliceObject*)item, Py_Size(self),
 				 &start, &stop, &step, &slicelength) < 0) {
 			return NULL;
 		}
@@ -2524,7 +2522,7 @@
 	else if (PySlice_Check(item)) {
 		Py_ssize_t start, stop, step, slicelength;
 
-		if (PySlice_GetIndicesEx((PySliceObject*)item, self->ob_size,
+		if (PySlice_GetIndicesEx((PySliceObject*)item, Py_Size(self),
 				 &start, &stop, &step, &slicelength) < 0) {
 			return -1;
 		}
@@ -2563,8 +2561,8 @@
 
 				garbage[i] = PyList_GET_ITEM(self, cur);
 
-				if (cur + step >= self->ob_size) {
-					lim = self->ob_size - cur - 1;
+				if (cur + step >= Py_Size(self)) {
+					lim = Py_Size(self) - cur - 1;
 				}
 
 				memmove(self->ob_item + cur - i,
@@ -2573,13 +2571,13 @@
 			}
 
 			for (cur = start + slicelength*step + 1;
-			     cur < self->ob_size; cur++) {
+			     cur < Py_Size(self); cur++) {
 				PyList_SET_ITEM(self, cur - slicelength,
 						PyList_GET_ITEM(self, cur));
 			}
 
-			self->ob_size -= slicelength;
-			list_resize(self, self->ob_size);
+			Py_Size(self) -= slicelength;
+			list_resize(self, Py_Size(self));
 
 			for (i = 0; i < slicelength; i++) {
 				Py_DECREF(garbage[i]);
@@ -2662,8 +2660,7 @@
 };
 
 PyTypeObject PyList_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"list",
 	sizeof(PyListObject),
 	0,
@@ -2728,8 +2725,7 @@
 };
 
 PyTypeObject PyListIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"listiterator",				/* tp_name */
 	sizeof(listiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -2851,8 +2847,7 @@
 };
 
 PyTypeObject PyListRevIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"listreverseiterator",			/* tp_name */
 	sizeof(listreviterobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/longobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/longobject.c	(original)
+++ python/branches/py3k-struni/Objects/longobject.c	Sat Jul 21 19:22:18 2007
@@ -46,11 +46,11 @@
 #define CHECK_SMALL_INT(ival)
 #endif
 
-#define MEDIUM_VALUE(x) ((x)->ob_size < 0 ? -(x)->ob_digit[0] : ((x)->ob_size == 0 ? 0 : (x)->ob_digit[0]))
+#define MEDIUM_VALUE(x) (Py_Size(x) < 0 ? -(x)->ob_digit[0] : (Py_Size(x) == 0 ? 0 : (x)->ob_digit[0]))
 /* If a freshly-allocated long is already shared, it must
    be a small integer, so negating it must go to PyLong_FromLong */
 #define NEGATE(x) \
-	do if ((x)->ob_refcnt == 1) (x)->ob_size = -(x)->ob_size;  \
+	do if (Py_Refcnt(x) == 1) Py_Size(x) = -Py_Size(x);  \
 	   else { PyObject* tmp=PyInt_FromLong(-MEDIUM_VALUE(x));  \
 		   Py_DECREF(x); (x) = (PyLongObject*)tmp; }	   \
         while(0)
@@ -94,13 +94,13 @@
 static PyLongObject *
 long_normalize(register PyLongObject *v)
 {
-	Py_ssize_t j = ABS(v->ob_size);
+	Py_ssize_t j = ABS(Py_Size(v));
 	Py_ssize_t i = j;
 
 	while (i > 0 && v->ob_digit[i-1] == 0)
 		--i;
 	if (i != j)
-		v->ob_size = (v->ob_size < 0) ? -(i) : i;
+		Py_Size(v) = (Py_Size(v) < 0) ? -(i) : i;
 	return v;
 }
 
@@ -134,18 +134,18 @@
 	Py_ssize_t i;
 
 	assert(src != NULL);
-	i = src->ob_size;
+	i = Py_Size(src);
 	if (i < 0)
 		i = -(i);
 	if (i < 2) {
 		int ival = src->ob_digit[0];
-		if (src->ob_size < 0)
+		if (Py_Size(src) < 0)
 			ival = -ival;
 		CHECK_SMALL_INT(ival);
 	}
 	result = _PyLong_New(i);
 	if (result != NULL) {
-		result->ob_size = src->ob_size;
+		Py_Size(result) = Py_Size(src);
 		while (--i >= 0)
 			result->ob_digit[i] = src->ob_digit[i];
 	}
@@ -170,22 +170,22 @@
 	}
 
 	/* Fast path for single-digits ints */
-	if (!(ival>>SHIFT)) {
+	if (!(ival>>PyLong_SHIFT)) {
 		v = _PyLong_New(1);
 		if (v) {
-			v->ob_size = sign;
+			Py_Size(v) = sign;
 			v->ob_digit[0] = ival;
 		}
 		return (PyObject*)v;
 	}
 
 	/* 2 digits */
-	if (!(ival >> 2*SHIFT)) {
+	if (!(ival >> 2*PyLong_SHIFT)) {
 		v = _PyLong_New(2);
 		if (v) {
-			v->ob_size = 2*sign;
-			v->ob_digit[0] = (digit)ival & MASK;
-			v->ob_digit[1] = ival >> SHIFT;
+			Py_Size(v) = 2*sign;
+			v->ob_digit[0] = (digit)ival & PyLong_MASK;
+			v->ob_digit[1] = ival >> PyLong_SHIFT;
 		}
 		return (PyObject*)v;
 	}
@@ -194,16 +194,16 @@
 	t = (unsigned long)ival;
 	while (t) {
 		++ndigits;
-		t >>= SHIFT;
+		t >>= PyLong_SHIFT;
 	}
 	v = _PyLong_New(ndigits);
 	if (v != NULL) {
 		digit *p = v->ob_digit;
-		v->ob_size = ndigits*sign;
+		Py_Size(v) = ndigits*sign;
 		t = (unsigned long)ival;
 		while (t) {
-			*p++ = (digit)(t & MASK);
-			t >>= SHIFT;
+			*p++ = (digit)(t & PyLong_MASK);
+			t >>= PyLong_SHIFT;
 		}
 	}
 	return (PyObject *)v;
@@ -218,21 +218,21 @@
 	unsigned long t;
 	int ndigits = 0;
 
-	if (ival < BASE)
+	if (ival < PyLong_BASE)
 		return PyLong_FromLong(ival);
 	/* Count the number of Python digits. */
 	t = (unsigned long)ival;
 	while (t) {
 		++ndigits;
-		t >>= SHIFT;
+		t >>= PyLong_SHIFT;
 	}
 	v = _PyLong_New(ndigits);
 	if (v != NULL) {
 		digit *p = v->ob_digit;
-		v->ob_size = ndigits;
+		Py_Size(v) = ndigits;
 		while (ival) {
-			*p++ = (digit)(ival & MASK);
-			ival >>= SHIFT;
+			*p++ = (digit)(ival & PyLong_MASK);
+			ival >>= PyLong_SHIFT;
 		}
 	}
 	return (PyObject *)v;
@@ -260,19 +260,19 @@
 	frac = frexp(dval, &expo); /* dval = frac*2**expo; 0.0 <= frac < 1.0 */
 	if (expo <= 0)
 		return PyLong_FromLong(0L);
-	ndig = (expo-1) / SHIFT + 1; /* Number of 'digits' in result */
+	ndig = (expo-1) / PyLong_SHIFT + 1; /* Number of 'digits' in result */
 	v = _PyLong_New(ndig);
 	if (v == NULL)
 		return NULL;
-	frac = ldexp(frac, (expo-1) % SHIFT + 1);
+	frac = ldexp(frac, (expo-1) % PyLong_SHIFT + 1);
 	for (i = ndig; --i >= 0; ) {
 		long bits = (long)frac;
 		v->ob_digit[i] = (digit) bits;
 		frac = frac - (double)bits;
-		frac = ldexp(frac, SHIFT);
+		frac = ldexp(frac, PyLong_SHIFT);
 	}
 	if (neg)
-		v->ob_size = -(v->ob_size);
+		Py_Size(v) = -(Py_Size(v));
 	return (PyObject *)v;
 }
 
@@ -328,7 +328,7 @@
 
 	res = -1;
 	v = (PyLongObject *)vv;
-	i = v->ob_size;
+	i = Py_Size(v);
 
 	switch (i) {
 	case -1:
@@ -349,8 +349,8 @@
 		}
 		while (--i >= 0) {
 			prev = x;
-			x = (x << SHIFT) + v->ob_digit[i];
-			if ((x >> SHIFT) != prev) {
+			x = (x << PyLong_SHIFT) + v->ob_digit[i];
+			if ((x >> PyLong_SHIFT) != prev) {
 				PyErr_SetString(PyExc_OverflowError,
 					"Python int too large to convert to C long");
 				goto exit;
@@ -386,7 +386,7 @@
 		return 0;
 	}
 	/* conservative estimate */
-	size = ((PyLongObject*)vv)->ob_size;
+	size = Py_Size(vv);
 	return -2 <= size && size <= 2;
 }
 
@@ -405,7 +405,7 @@
 		return -1;
 	}
 	v = (PyLongObject *)vv;
-	i = v->ob_size;
+	i = Py_Size(v);
 	switch (i) {
 	case -1: return -v->ob_digit[0];
 	case 0: return 0;
@@ -419,8 +419,8 @@
 	}
 	while (--i >= 0) {
 		prev = x;
-		x = (x << SHIFT) + v->ob_digit[i];
-		if ((x >> SHIFT) != prev)
+		x = (x << PyLong_SHIFT) + v->ob_digit[i];
+		if ((x >> PyLong_SHIFT) != prev)
 			goto overflow;
 	}
 	/* Haven't lost any bits, but casting to a signed type requires
@@ -455,7 +455,7 @@
 		return (unsigned long) -1;
 	}
 	v = (PyLongObject *)vv;
-	i = v->ob_size;
+	i = Py_Size(v);
 	x = 0;
 	if (i < 0) {
 		PyErr_SetString(PyExc_OverflowError,
@@ -468,8 +468,8 @@
 	}
 	while (--i >= 0) {
 		prev = x;
-		x = (x << SHIFT) + v->ob_digit[i];
-		if ((x >> SHIFT) != prev) {
+		x = (x << PyLong_SHIFT) + v->ob_digit[i];
+		if ((x >> PyLong_SHIFT) != prev) {
 			PyErr_SetString(PyExc_OverflowError,
 			 "python int too large to convert to C unsigned long");
 			return (unsigned long) -1;
@@ -493,7 +493,7 @@
 		return (unsigned long) -1;
 	}
 	v = (PyLongObject *)vv;
-	i = v->ob_size;
+	i = Py_Size(v);
 	x = 0;
 	if (i < 0) {
 		PyErr_SetString(PyExc_OverflowError,
@@ -506,8 +506,8 @@
 	}
 	while (--i >= 0) {
 		prev = x;
-		x = (x << SHIFT) + v->ob_digit[i];
-		if ((x >> SHIFT) != prev) {
+		x = (x << PyLong_SHIFT) + v->ob_digit[i];
+		if ((x >> PyLong_SHIFT) != prev) {
 			PyErr_SetString(PyExc_OverflowError,
 			    "Python int too large to convert to C size_t");
 			return (unsigned long) -1;
@@ -532,7 +532,7 @@
 		return (unsigned long) -1;
 	}
 	v = (PyLongObject *)vv;
-	i = v->ob_size;
+	i = Py_Size(v);
 	switch (i) {
 	case 0: return 0;
 	case 1: return v->ob_digit[0];
@@ -544,7 +544,7 @@
 		i = -i;
 	}
 	while (--i >= 0) {
-		x = (x << SHIFT) + v->ob_digit[i];
+		x = (x << PyLong_SHIFT) + v->ob_digit[i];
 	}
 	return x * sign;
 }
@@ -592,7 +592,7 @@
 	assert(v != NULL);
 	assert(PyLong_Check(v));
 
-	return v->ob_size == 0 ? 0 : (v->ob_size < 0 ? -1 : 1);
+	return Py_Size(v) == 0 ? 0 : (Py_Size(v) < 0 ? -1 : 1);
 }
 
 size_t
@@ -604,13 +604,13 @@
 
 	assert(v != NULL);
 	assert(PyLong_Check(v));
-	ndigits = ABS(v->ob_size);
+	ndigits = ABS(Py_Size(v));
 	assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
 	if (ndigits > 0) {
 		digit msd = v->ob_digit[ndigits - 1];
 
-		result = (ndigits - 1) * SHIFT;
-		if (result / SHIFT != (size_t)(ndigits - 1))
+		result = (ndigits - 1) * PyLong_SHIFT;
+		if (result / PyLong_SHIFT != (size_t)(ndigits - 1))
 			goto Overflow;
 		do {
 			++result;
@@ -680,9 +680,9 @@
 	}
 
 	/* How many Python long digits do we need?  We have
-	   8*numsignificantbytes bits, and each Python long digit has SHIFT
+	   8*numsignificantbytes bits, and each Python long digit has PyLong_SHIFT
 	   bits, so it's the ceiling of the quotient. */
-	ndigits = (numsignificantbytes * 8 + SHIFT - 1) / SHIFT;
+	ndigits = (numsignificantbytes * 8 + PyLong_SHIFT - 1) / PyLong_SHIFT;
 	if (ndigits > (size_t)INT_MAX)
 		return PyErr_NoMemory();
 	v = _PyLong_New((int)ndigits);
@@ -712,17 +712,17 @@
 			   so needs to be prepended to accum. */
 			accum |= thisbyte << accumbits;
 			accumbits += 8;
-			if (accumbits >= SHIFT) {
+			if (accumbits >= PyLong_SHIFT) {
 				/* There's enough to fill a Python digit. */
 				assert(idigit < (int)ndigits);
-				v->ob_digit[idigit] = (digit)(accum & MASK);
+				v->ob_digit[idigit] = (digit)(accum & PyLong_MASK);
 				++idigit;
-				accum >>= SHIFT;
-				accumbits -= SHIFT;
-				assert(accumbits < SHIFT);
+				accum >>= PyLong_SHIFT;
+				accumbits -= PyLong_SHIFT;
+				assert(accumbits < PyLong_SHIFT);
 			}
 		}
-		assert(accumbits < SHIFT);
+		assert(accumbits < PyLong_SHIFT);
 		if (accumbits) {
 			assert(idigit < (int)ndigits);
 			v->ob_digit[idigit] = (digit)accum;
@@ -730,7 +730,7 @@
 		}
 	}
 
-	v->ob_size = is_signed ? -idigit : idigit;
+	Py_Size(v) = is_signed ? -idigit : idigit;
 	return (PyObject *)long_normalize(v);
 }
 
@@ -751,8 +751,8 @@
 
 	assert(v != NULL && PyLong_Check(v));
 
-	if (v->ob_size < 0) {
-		ndigits = -(v->ob_size);
+	if (Py_Size(v) < 0) {
+		ndigits = -(Py_Size(v));
 		if (!is_signed) {
 			PyErr_SetString(PyExc_TypeError,
 				"can't convert negative int to unsigned");
@@ -761,7 +761,7 @@
 		do_twos_comp = 1;
 	}
 	else {
-		ndigits = v->ob_size;
+		ndigits = Py_Size(v);
 		do_twos_comp = 0;
 	}
 
@@ -776,7 +776,7 @@
 
 	/* Copy over all the Python digits.
 	   It's crucial that every Python digit except for the MSD contribute
-	   exactly SHIFT bits to the total, so first assert that the long is
+	   exactly PyLong_SHIFT bits to the total, so first assert that the long is
 	   normalized. */
 	assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
 	j = 0;
@@ -786,15 +786,15 @@
 	for (i = 0; i < ndigits; ++i) {
 		twodigits thisdigit = v->ob_digit[i];
 		if (do_twos_comp) {
-			thisdigit = (thisdigit ^ MASK) + carry;
-			carry = thisdigit >> SHIFT;
-			thisdigit &= MASK;
+			thisdigit = (thisdigit ^ PyLong_MASK) + carry;
+			carry = thisdigit >> PyLong_SHIFT;
+			thisdigit &= PyLong_MASK;
 		}
 		/* Because we're going LSB to MSB, thisdigit is more
 		   significant than what's already in accum, so needs to be
 		   prepended to accum. */
 		accum |= thisdigit << accumbits;
-		accumbits += SHIFT;
+		accumbits += PyLong_SHIFT;
 
 		/* The most-significant digit may be (probably is) at least
 		   partly empty. */
@@ -805,9 +805,9 @@
 			 * First shift conceptual sign bit to real sign bit.
 			 */
 			stwodigits s = (stwodigits)(thisdigit <<
-				(8*sizeof(stwodigits) - SHIFT));
+				(8*sizeof(stwodigits) - PyLong_SHIFT));
 			unsigned int nsignbits = 0;
-			while ((s < 0) == do_twos_comp && nsignbits < SHIFT) {
+			while ((s < 0) == do_twos_comp && nsignbits < PyLong_SHIFT) {
 				++nsignbits;
 				s <<= 1;
 			}
@@ -887,7 +887,7 @@
 #define NBITS_WANTED 57
 	PyLongObject *v;
 	double x;
-	const double multiplier = (double)(1L << SHIFT);
+	const double multiplier = (double)(1L << PyLong_SHIFT);
 	Py_ssize_t i;
 	int sign;
 	int nbitsneeded;
@@ -897,7 +897,7 @@
 		return -1;
 	}
 	v = (PyLongObject *)vv;
-	i = v->ob_size;
+	i = Py_Size(v);
 	sign = 1;
 	if (i < 0) {
 		sign = -1;
@@ -914,10 +914,10 @@
 	while (i > 0 && nbitsneeded > 0) {
 		--i;
 		x = x * multiplier + (double)v->ob_digit[i];
-		nbitsneeded -= SHIFT;
+		nbitsneeded -= PyLong_SHIFT;
 	}
 	/* There are i digits we didn't shift in.  Pretending they're all
-	   zeroes, the true value is x * 2**(i*SHIFT). */
+	   zeroes, the true value is x * 2**(i*PyLong_SHIFT). */
 	*exponent = i;
 	assert(x > 0.0);
 	return x * sign;
@@ -942,10 +942,10 @@
 	/* 'e' initialized to -1 to silence gcc-4.0.x, but it should be
 	   set correctly after a successful _PyLong_AsScaledDouble() call */
 	assert(e >= 0);
-	if (e > INT_MAX / SHIFT)
+	if (e > INT_MAX / PyLong_SHIFT)
 		goto overflow;
 	errno = 0;
-	x = ldexp(x, e * SHIFT);
+	x = ldexp(x, e * PyLong_SHIFT);
 	if (Py_OVERFLOWED(x))
 		goto overflow;
 	return x;
@@ -1043,16 +1043,16 @@
 	t = (unsigned PY_LONG_LONG)ival;
 	while (t) {
 		++ndigits;
-		t >>= SHIFT;
+		t >>= PyLong_SHIFT;
 	}
 	v = _PyLong_New(ndigits);
 	if (v != NULL) {
 		digit *p = v->ob_digit;
-		v->ob_size = negative ? -ndigits : ndigits;
+		Py_Size(v) = negative ? -ndigits : ndigits;
 		t = (unsigned PY_LONG_LONG)ival;
 		while (t) {
-			*p++ = (digit)(t & MASK);
-			t >>= SHIFT;
+			*p++ = (digit)(t & PyLong_MASK);
+			t >>= PyLong_SHIFT;
 		}
 	}
 	return (PyObject *)v;
@@ -1067,21 +1067,21 @@
 	unsigned PY_LONG_LONG t;
 	int ndigits = 0;
 
-	if (ival < BASE)
+	if (ival < PyLong_BASE)
 		return PyLong_FromLong(ival);
 	/* Count the number of Python digits. */
 	t = (unsigned PY_LONG_LONG)ival;
 	while (t) {
 		++ndigits;
-		t >>= SHIFT;
+		t >>= PyLong_SHIFT;
 	}
 	v = _PyLong_New(ndigits);
 	if (v != NULL) {
 		digit *p = v->ob_digit;
-		v->ob_size = ndigits;
+		Py_Size(v) = ndigits;
 		while (ival) {
-			*p++ = (digit)(ival & MASK);
-			ival >>= SHIFT;
+			*p++ = (digit)(ival & PyLong_MASK);
+			ival >>= PyLong_SHIFT;
 		}
 	}
 	return (PyObject *)v;
@@ -1094,7 +1094,7 @@
 {
 	Py_ssize_t bytes = ival;
 	int one = 1;
-	if (ival < BASE)
+	if (ival < PyLong_BASE)
 		return PyLong_FromLong(ival);
 	return _PyLong_FromByteArray(
 			(unsigned char *)&bytes,
@@ -1108,7 +1108,7 @@
 {
 	size_t bytes = ival;
 	int one = 1;
-	if (ival < BASE)
+	if (ival < PyLong_BASE)
 		return PyLong_FromLong(ival);
 	return _PyLong_FromByteArray(
 			(unsigned char *)&bytes,
@@ -1152,7 +1152,7 @@
 	}
 
 	v = (PyLongObject*)vv;
-	switch(v->ob_size) {
+	switch(Py_Size(v)) {
 	case -1: return -v->ob_digit[0];
 	case 0: return 0;
 	case 1: return v->ob_digit[0];
@@ -1185,7 +1185,7 @@
 	}
 
 	v = (PyLongObject*)vv;
-	switch(v->ob_size) {
+	switch(Py_Size(v)) {
 	case 0: return 0;
 	case 1: return v->ob_digit[0];
 	}
@@ -1217,11 +1217,11 @@
 		return (unsigned long) -1;
 	}
 	v = (PyLongObject *)vv;
-	switch(v->ob_size) {
+	switch(Py_Size(v)) {
 	case 0: return 0;
 	case 1: return v->ob_digit[0];
 	}
-	i = v->ob_size;
+	i = Py_Size(v);
 	sign = 1;
 	x = 0;
 	if (i < 0) {
@@ -1229,7 +1229,7 @@
 		i = -i;
 	}
 	while (--i >= 0) {
-		x = (x << SHIFT) + v->ob_digit[i];
+		x = (x << PyLong_SHIFT) + v->ob_digit[i];
 	}
 	return x * sign;
 }
@@ -1312,14 +1312,14 @@
 	assert(m >= n);
 	for (i = 0; i < n; ++i) {
 		carry += x[i] + y[i];
-		x[i] = carry & MASK;
-		carry >>= SHIFT;
+		x[i] = carry & PyLong_MASK;
+		carry >>= PyLong_SHIFT;
 		assert((carry & 1) == carry);
 	}
 	for (; carry && i < m; ++i) {
 		carry += x[i];
-		x[i] = carry & MASK;
-		carry >>= SHIFT;
+		x[i] = carry & PyLong_MASK;
+		carry >>= PyLong_SHIFT;
 		assert((carry & 1) == carry);
 	}
 	return carry;
@@ -1338,14 +1338,14 @@
 	assert(m >= n);
 	for (i = 0; i < n; ++i) {
 		borrow = x[i] - y[i] - borrow;
-		x[i] = borrow & MASK;
-		borrow >>= SHIFT;
+		x[i] = borrow & PyLong_MASK;
+		borrow >>= PyLong_SHIFT;
 		borrow &= 1;	/* keep only 1 sign bit */
 	}
 	for (; borrow && i < m; ++i) {
 		borrow = x[i] - borrow;
-		x[i] = borrow & MASK;
-		borrow >>= SHIFT;
+		x[i] = borrow & PyLong_MASK;
+		borrow >>= PyLong_SHIFT;
 		borrow &= 1;
 	}
 	return borrow;
@@ -1364,7 +1364,7 @@
 static PyLongObject *
 muladd1(PyLongObject *a, wdigit n, wdigit extra)
 {
-	Py_ssize_t size_a = ABS(a->ob_size);
+	Py_ssize_t size_a = ABS(Py_Size(a));
 	PyLongObject *z = _PyLong_New(size_a+1);
 	twodigits carry = extra;
 	Py_ssize_t i;
@@ -1373,8 +1373,8 @@
 		return NULL;
 	for (i = 0; i < size_a; ++i) {
 		carry += (twodigits)a->ob_digit[i] * n;
-		z->ob_digit[i] = (digit) (carry & MASK);
-		carry >>= SHIFT;
+		z->ob_digit[i] = (digit) (carry & PyLong_MASK);
+		carry >>= PyLong_SHIFT;
 	}
 	z->ob_digit[i] = (digit) carry;
 	return long_normalize(z);
@@ -1391,12 +1391,12 @@
 {
 	twodigits rem = 0;
 
-	assert(n > 0 && n <= MASK);
+	assert(n > 0 && n <= PyLong_MASK);
 	pin += size;
 	pout += size;
 	while (--size >= 0) {
 		digit hi;
-		rem = (rem << SHIFT) + *--pin;
+		rem = (rem << PyLong_SHIFT) + *--pin;
 		*--pout = hi = (digit)(rem / n);
 		rem -= hi * n;
 	}
@@ -1410,10 +1410,10 @@
 static PyLongObject *
 divrem1(PyLongObject *a, digit n, digit *prem)
 {
-	const Py_ssize_t size = ABS(a->ob_size);
+	const Py_ssize_t size = ABS(Py_Size(a));
 	PyLongObject *z;
 
-	assert(n > 0 && n <= MASK);
+	assert(n > 0 && n <= PyLong_MASK);
 	z = _PyLong_New(size);
 	if (z == NULL)
 		return NULL;
@@ -1441,7 +1441,7 @@
 		return NULL;
 	}
 	assert(base >= 2 && base <= 36);
-	size_a = ABS(a->ob_size);
+	size_a = ABS(Py_Size(a));
 
 	/* Compute a rough upper bound for the length of the string */
 	i = base;
@@ -1451,9 +1451,9 @@
 		i >>= 1;
 	}
 	i = 5;
-	j = size_a*SHIFT + bits-1;
+	j = size_a*PyLong_SHIFT + bits-1;
 	sz = i + j / bits;
-	if (j / SHIFT < size_a || sz < i) {
+	if (j / PyLong_SHIFT < size_a || sz < i) {
 		PyErr_SetString(PyExc_OverflowError,
 				"int is too large to format");
 		return NULL;
@@ -1463,10 +1463,10 @@
 		return NULL;
 	p = PyUnicode_AS_UNICODE(str) + sz;
 	*p = '\0';
-	if (a->ob_size < 0)
+	if (Py_Size(a) < 0)
 		sign = '-';
 
-	if (a->ob_size == 0) {
+	if (Py_Size(a) == 0) {
 		*--p = '0';
 	}
 	else if ((base & (base - 1)) == 0) {
@@ -1480,7 +1480,7 @@
 
 		for (i = 0; i < size_a; ++i) {
 			accum |= (twodigits)a->ob_digit[i] << accumbits;
-			accumbits += SHIFT;
+			accumbits += PyLong_SHIFT;
 			assert(accumbits >= basebits);
 			do {
 				char cdigit = (char)(accum & (base - 1));
@@ -1505,7 +1505,7 @@
 		int power = 1;
 		for (;;) {
 			unsigned long newpow = powbase * (unsigned long)base;
-			if (newpow >> SHIFT)  /* doesn't fit in a digit */
+			if (newpow >> PyLong_SHIFT)  /* doesn't fit in a digit */
 				break;
 			powbase = (digit)newpow;
 			++power;
@@ -1589,7 +1589,7 @@
  * 'a' and 'A' map to 10, ..., 'z' and 'Z' map to 35.
  * All other indices map to 37.
  * Note that when converting a base B string, a char c is a legitimate
- * base B digit iff _PyLong_DigitValue[Py_CHARMASK(c)] < B.
+ * base B digit iff _PyLong_DigitValue[Py_CHARPyLong_MASK(c)] < B.
  */
 int _PyLong_DigitValue[256] = {
 	37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
@@ -1637,14 +1637,14 @@
 	while (_PyLong_DigitValue[Py_CHARMASK(*p)] < base)
 		++p;
 	*str = p;
-	/* n <- # of Python digits needed, = ceiling(n/SHIFT). */
-	n = (p - start) * bits_per_char + SHIFT - 1;
+	/* n <- # of Python digits needed, = ceiling(n/PyLong_SHIFT). */
+	n = (p - start) * bits_per_char + PyLong_SHIFT - 1;
 	if (n / bits_per_char < p - start) {
 		PyErr_SetString(PyExc_ValueError,
 				"int string too large to convert");
 		return NULL;
 	}
-	n = n / SHIFT;
+	n = n / PyLong_SHIFT;
 	z = _PyLong_New(n);
 	if (z == NULL)
 		return NULL;
@@ -1659,16 +1659,16 @@
 		assert(k >= 0 && k < base);
 		accum |= (twodigits)(k << bits_in_accum);
 		bits_in_accum += bits_per_char;
-		if (bits_in_accum >= SHIFT) {
-			*pdigit++ = (digit)(accum & MASK);
+		if (bits_in_accum >= PyLong_SHIFT) {
+			*pdigit++ = (digit)(accum & PyLong_MASK);
 			assert(pdigit - z->ob_digit <= (int)n);
-			accum >>= SHIFT;
-			bits_in_accum -= SHIFT;
-			assert(bits_in_accum < SHIFT);
+			accum >>= PyLong_SHIFT;
+			bits_in_accum -= PyLong_SHIFT;
+			assert(bits_in_accum < PyLong_SHIFT);
 		}
 	}
 	if (bits_in_accum) {
-		assert(bits_in_accum <= SHIFT);
+		assert(bits_in_accum <= PyLong_SHIFT);
 		*pdigit++ = (digit)accum;
 		assert(pdigit - z->ob_digit <= (int)n);
 	}
@@ -1829,10 +1829,10 @@
 			int i = 1;
 
 			log_base_BASE[base] = log((double)base) /
-						log((double)BASE);
+						log((double)PyLong_BASE);
 			for (;;) {
 				twodigits next = convmax * base;
-				if (next > BASE)
+				if (next > PyLong_BASE)
 					break;
 				convmax = next;
 				++i;
@@ -1859,7 +1859,7 @@
 		z = _PyLong_New(size_z);
 		if (z == NULL)
 			return NULL;
-		z->ob_size = 0;
+		Py_Size(z) = 0;
 
 		/* `convwidth` consecutive input digits are treated as a single
 		 * digit in base `convmultmax`.
@@ -1874,7 +1874,7 @@
 			for (i = 1; i < convwidth && str != scan; ++i, ++str) {
 				c = (twodigits)(c *  base +
 					_PyLong_DigitValue[Py_CHARMASK(*str)]);
-				assert(c < BASE);
+				assert(c < PyLong_BASE);
 			}
 
 			convmult = convmultmax;
@@ -1889,23 +1889,23 @@
 
 			/* Multiply z by convmult, and add c. */
 			pz = z->ob_digit;
-			pzstop = pz + z->ob_size;
+			pzstop = pz + Py_Size(z);
 			for (; pz < pzstop; ++pz) {
 				c += (twodigits)*pz * convmult;
-				*pz = (digit)(c & MASK);
-				c >>= SHIFT;
+				*pz = (digit)(c & PyLong_MASK);
+				c >>= PyLong_SHIFT;
 			}
 			/* carry off the current end? */
 			if (c) {
-				assert(c < BASE);
-				if (z->ob_size < size_z) {
+				assert(c < PyLong_BASE);
+				if (Py_Size(z) < size_z) {
 					*pz = (digit)c;
-					++z->ob_size;
+					++Py_Size(z);
 				}
 				else {
 					PyLongObject *tmp;
 					/* Extremely rare.  Get more space. */
-					assert(z->ob_size == size_z);
+					assert(Py_Size(z) == size_z);
 					tmp = _PyLong_New(size_z + 1);
 					if (tmp == NULL) {
 						Py_DECREF(z);
@@ -1928,7 +1928,7 @@
 		/* reset the base to 0, else the exception message
 		   doesn't make too much sense */
 		base = 0;
-		if (z->ob_size != 0)
+		if (Py_Size(z) != 0)
 			goto onError;
 		/* there might still be other problems, therefore base
 		   remains zero here for the same reason */
@@ -1936,7 +1936,7 @@
 	if (str == start)
 		goto onError;
 	if (sign < 0)
-		z->ob_size = -(z->ob_size);
+		Py_Size(z) = -(Py_Size(z));
 	if (*str == 'L' || *str == 'l')
 		str++;
 	while (*str && isspace(Py_CHARMASK(*str)))
@@ -1995,7 +1995,7 @@
 long_divrem(PyLongObject *a, PyLongObject *b,
 	    PyLongObject **pdiv, PyLongObject **prem)
 {
-	Py_ssize_t size_a = ABS(a->ob_size), size_b = ABS(b->ob_size);
+	Py_ssize_t size_a = ABS(Py_Size(a)), size_b = ABS(Py_Size(b));
 	PyLongObject *z;
 
 	if (size_b == 0) {
@@ -2034,9 +2034,9 @@
 	   The quotient z has the sign of a*b;
 	   the remainder r has the sign of a,
 	   so a = b*z + r. */
-	if ((a->ob_size < 0) != (b->ob_size < 0))
+	if ((Py_Size(a) < 0) != (Py_Size(b) < 0))
 		NEGATE(z);
-	if (a->ob_size < 0 && (*prem)->ob_size != 0)
+	if (Py_Size(a) < 0 && Py_Size(*prem) != 0)
 		NEGATE(*prem);
 	*pdiv = z;
 	return 0;
@@ -2047,8 +2047,8 @@
 static PyLongObject *
 x_divrem(PyLongObject *v1, PyLongObject *w1, PyLongObject **prem)
 {
-	Py_ssize_t size_v = ABS(v1->ob_size), size_w = ABS(w1->ob_size);
-	digit d = (digit) ((twodigits)BASE / (w1->ob_digit[size_w-1] + 1));
+	Py_ssize_t size_v = ABS(Py_Size(v1)), size_w = ABS(Py_Size(w1));
+	digit d = (digit) ((twodigits)PyLong_BASE / (w1->ob_digit[size_w-1] + 1));
 	PyLongObject *v = mul1(v1, d);
 	PyLongObject *w = mul1(w1, d);
 	PyLongObject *a;
@@ -2061,10 +2061,10 @@
 	}
 
 	assert(size_v >= size_w && size_w > 1); /* Assert checks by div() */
-	assert(v->ob_refcnt == 1); /* Since v will be used as accumulator! */
-	assert(size_w == ABS(w->ob_size)); /* That's how d was calculated */
+	assert(Py_Refcnt(v) == 1); /* Since v will be used as accumulator! */
+	assert(size_w == ABS(Py_Size(w))); /* That's how d was calculated */
 
-	size_v = ABS(v->ob_size);
+	size_v = ABS(Py_Size(v));
 	k = size_v - size_w;
 	a = _PyLong_New(k + 1);
 
@@ -2080,28 +2080,28 @@
 			break;
 		})
 		if (vj == w->ob_digit[size_w-1])
-			q = MASK;
+			q = PyLong_MASK;
 		else
-			q = (((twodigits)vj << SHIFT) + v->ob_digit[j-1]) /
+			q = (((twodigits)vj << PyLong_SHIFT) + v->ob_digit[j-1]) /
 				w->ob_digit[size_w-1];
 
 		while (w->ob_digit[size_w-2]*q >
 				((
-					((twodigits)vj << SHIFT)
+					((twodigits)vj << PyLong_SHIFT)
 					+ v->ob_digit[j-1]
 					- q*w->ob_digit[size_w-1]
-								) << SHIFT)
+								) << PyLong_SHIFT)
 				+ v->ob_digit[j-2])
 			--q;
 
 		for (i = 0; i < size_w && i+k < size_v; ++i) {
 			twodigits z = w->ob_digit[i] * q;
-			digit zz = (digit) (z >> SHIFT);
+			digit zz = (digit) (z >> PyLong_SHIFT);
 			carry += v->ob_digit[i+k] - z
-				+ ((twodigits)zz << SHIFT);
-			v->ob_digit[i+k] = (digit)(carry & MASK);
+				+ ((twodigits)zz << PyLong_SHIFT);
+			v->ob_digit[i+k] = (digit)(carry & PyLong_MASK);
 			carry = Py_ARITHMETIC_RIGHT_SHIFT(BASE_TWODIGITS_TYPE,
-							  carry, SHIFT);
+							  carry, PyLong_SHIFT);
 			carry -= zz;
 		}
 
@@ -2118,10 +2118,10 @@
 			carry = 0;
 			for (i = 0; i < size_w && i+k < size_v; ++i) {
 				carry += v->ob_digit[i+k] + w->ob_digit[i];
-				v->ob_digit[i+k] = (digit)(carry & MASK);
+				v->ob_digit[i+k] = (digit)(carry & PyLong_MASK);
 				carry = Py_ARITHMETIC_RIGHT_SHIFT(
 						BASE_TWODIGITS_TYPE,
-						carry, SHIFT);
+						carry, PyLong_SHIFT);
 			}
 		}
 	} /* for j, k */
@@ -2147,7 +2147,7 @@
 static void
 long_dealloc(PyObject *v)
 {
-	v->ob_type->tp_free(v);
+	Py_Type(v)->tp_free(v);
 }
 
 static PyObject *
@@ -2161,21 +2161,21 @@
 {
 	Py_ssize_t sign;
 
-	if (a->ob_size != b->ob_size) {
-		if (ABS(a->ob_size) == 0 && ABS(b->ob_size) == 0)
+	if (Py_Size(a) != Py_Size(b)) {
+		if (ABS(Py_Size(a)) == 0 && ABS(Py_Size(b)) == 0)
 			sign = 0;
 		else
-			sign = a->ob_size - b->ob_size;
+			sign = Py_Size(a) - Py_Size(b);
 	}
 	else {
-		Py_ssize_t i = ABS(a->ob_size);
+		Py_ssize_t i = ABS(Py_Size(a));
 		while (--i >= 0 && a->ob_digit[i] == b->ob_digit[i])
 			;
 		if (i < 0)
 			sign = 0;
 		else {
 			sign = (int)a->ob_digit[i] - (int)b->ob_digit[i];
-			if (a->ob_size < 0)
+			if (Py_Size(a) < 0)
 				sign = -sign;
 		}
 	}
@@ -2204,7 +2204,7 @@
 	/* This is designed so that Python ints and longs with the
 	   same value hash to the same value, otherwise comparisons
 	   of mapping keys will turn out weird */
-	i = v->ob_size;
+	i = Py_Size(v);
 	switch(i) {
 	case -1: return v->ob_digit[0]==1 ? -2 : -v->ob_digit[0];
 	case 0: return 0;
@@ -2216,13 +2216,13 @@
 		sign = -1;
 		i = -(i);
 	}
-#define LONG_BIT_SHIFT	(8*sizeof(long) - SHIFT)
+#define LONG_BIT_PyLong_SHIFT	(8*sizeof(long) - PyLong_SHIFT)
 	while (--i >= 0) {
 		/* Force a native long #-bits (32 or 64) circular shift */
-		x = ((x << SHIFT) & ~MASK) | ((x >> LONG_BIT_SHIFT) & MASK);
+		x = ((x << PyLong_SHIFT) & ~PyLong_MASK) | ((x >> LONG_BIT_PyLong_SHIFT) & PyLong_MASK);
 		x += v->ob_digit[i];
 	}
-#undef LONG_BIT_SHIFT
+#undef LONG_BIT_PyLong_SHIFT
 	x = x * sign;
 	if (x == -1)
 		x = -2;
@@ -2235,7 +2235,7 @@
 static PyLongObject *
 x_add(PyLongObject *a, PyLongObject *b)
 {
-	Py_ssize_t size_a = ABS(a->ob_size), size_b = ABS(b->ob_size);
+	Py_ssize_t size_a = ABS(Py_Size(a)), size_b = ABS(Py_Size(b));
 	PyLongObject *z;
 	int i;
 	digit carry = 0;
@@ -2252,13 +2252,13 @@
 		return NULL;
 	for (i = 0; i < size_b; ++i) {
 		carry += a->ob_digit[i] + b->ob_digit[i];
-		z->ob_digit[i] = carry & MASK;
-		carry >>= SHIFT;
+		z->ob_digit[i] = carry & PyLong_MASK;
+		carry >>= PyLong_SHIFT;
 	}
 	for (; i < size_a; ++i) {
 		carry += a->ob_digit[i];
-		z->ob_digit[i] = carry & MASK;
-		carry >>= SHIFT;
+		z->ob_digit[i] = carry & PyLong_MASK;
+		carry >>= PyLong_SHIFT;
 	}
 	z->ob_digit[i] = carry;
 	return long_normalize(z);
@@ -2269,7 +2269,7 @@
 static PyLongObject *
 x_sub(PyLongObject *a, PyLongObject *b)
 {
-	Py_ssize_t size_a = ABS(a->ob_size), size_b = ABS(b->ob_size);
+	Py_ssize_t size_a = ABS(Py_Size(a)), size_b = ABS(Py_Size(b));
 	PyLongObject *z;
 	Py_ssize_t i;
 	int sign = 1;
@@ -2301,16 +2301,16 @@
 		return NULL;
 	for (i = 0; i < size_b; ++i) {
 		/* The following assumes unsigned arithmetic
-		   works module 2**N for some N>SHIFT. */
+		   works module 2**N for some N>PyLong_SHIFT. */
 		borrow = a->ob_digit[i] - b->ob_digit[i] - borrow;
-		z->ob_digit[i] = borrow & MASK;
-		borrow >>= SHIFT;
+		z->ob_digit[i] = borrow & PyLong_MASK;
+		borrow >>= PyLong_SHIFT;
 		borrow &= 1; /* Keep only one sign bit */
 	}
 	for (; i < size_a; ++i) {
 		borrow = a->ob_digit[i] - borrow;
-		z->ob_digit[i] = borrow & MASK;
-		borrow >>= SHIFT;
+		z->ob_digit[i] = borrow & PyLong_MASK;
+		borrow >>= PyLong_SHIFT;
 		borrow &= 1; /* Keep only one sign bit */
 	}
 	assert(borrow == 0);
@@ -2326,24 +2326,24 @@
 
 	CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b);
 
-	if (ABS(a->ob_size) <= 1 && ABS(b->ob_size) <= 1) {
+	if (ABS(Py_Size(a)) <= 1 && ABS(Py_Size(b)) <= 1) {
 		PyObject *result = PyInt_FromLong(MEDIUM_VALUE(a) +
 						  MEDIUM_VALUE(b));
 		Py_DECREF(a);
 		Py_DECREF(b);
 		return result;
 	}
-	if (a->ob_size < 0) {
-		if (b->ob_size < 0) {
+	if (Py_Size(a) < 0) {
+		if (Py_Size(b) < 0) {
 			z = x_add(a, b);
-			if (z != NULL && z->ob_size != 0)
-				z->ob_size = -(z->ob_size);
+			if (z != NULL && Py_Size(z) != 0)
+				Py_Size(z) = -(Py_Size(z));
 		}
 		else
 			z = x_sub(b, a);
 	}
 	else {
-		if (b->ob_size < 0)
+		if (Py_Size(b) < 0)
 			z = x_sub(a, b);
 		else
 			z = x_add(a, b);
@@ -2360,23 +2360,23 @@
 
 	CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b);
 
-	if (ABS(a->ob_size) <= 1 && ABS(b->ob_size) <= 1) {
+	if (ABS(Py_Size(a)) <= 1 && ABS(Py_Size(b)) <= 1) {
 		PyObject* r;
 		r = PyLong_FromLong(MEDIUM_VALUE(a)-MEDIUM_VALUE(b));
 		Py_DECREF(a);
 		Py_DECREF(b);
 		return r;
 	}
-	if (a->ob_size < 0) {
-		if (b->ob_size < 0)
+	if (Py_Size(a) < 0) {
+		if (Py_Size(b) < 0)
 			z = x_sub(a, b);
 		else
 			z = x_add(a, b);
-		if (z != NULL && z->ob_size != 0)
-			z->ob_size = -(z->ob_size);
+		if (z != NULL && Py_Size(z) != 0)
+			Py_Size(z) = -(Py_Size(z));
 	}
 	else {
-		if (b->ob_size < 0)
+		if (Py_Size(b) < 0)
 			z = x_add(a, b);
 		else
 			z = x_sub(a, b);
@@ -2393,15 +2393,15 @@
 x_mul(PyLongObject *a, PyLongObject *b)
 {
 	PyLongObject *z;
-	Py_ssize_t size_a = ABS(a->ob_size);
-	Py_ssize_t size_b = ABS(b->ob_size);
+	Py_ssize_t size_a = ABS(Py_Size(a));
+	Py_ssize_t size_b = ABS(Py_Size(b));
 	Py_ssize_t i;
 
      	z = _PyLong_New(size_a + size_b);
 	if (z == NULL)
 		return NULL;
 
-	memset(z->ob_digit, 0, z->ob_size * sizeof(digit));
+	memset(z->ob_digit, 0, Py_Size(z) * sizeof(digit));
 	if (a == b) {
 		/* Efficient squaring per HAC, Algorithm 14.16:
 		 * http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf
@@ -2422,9 +2422,9 @@
 			})
 
 			carry = *pz + f * f;
-			*pz++ = (digit)(carry & MASK);
-			carry >>= SHIFT;
-			assert(carry <= MASK);
+			*pz++ = (digit)(carry & PyLong_MASK);
+			carry >>= PyLong_SHIFT;
+			assert(carry <= PyLong_MASK);
 
 			/* Now f is added in twice in each column of the
 			 * pyramid it appears.  Same as adding f<<1 once.
@@ -2432,18 +2432,18 @@
 			f <<= 1;
 			while (pa < paend) {
 				carry += *pz + *pa++ * f;
-				*pz++ = (digit)(carry & MASK);
-				carry >>= SHIFT;
-				assert(carry <= (MASK << 1));
+				*pz++ = (digit)(carry & PyLong_MASK);
+				carry >>= PyLong_SHIFT;
+				assert(carry <= (PyLong_MASK << 1));
 			}
 			if (carry) {
 				carry += *pz;
-				*pz++ = (digit)(carry & MASK);
-				carry >>= SHIFT;
+				*pz++ = (digit)(carry & PyLong_MASK);
+				carry >>= PyLong_SHIFT;
 			}
 			if (carry)
-				*pz += (digit)(carry & MASK);
-			assert((carry >> SHIFT) == 0);
+				*pz += (digit)(carry & PyLong_MASK);
+			assert((carry >> PyLong_SHIFT) == 0);
 		}
 	}
 	else {	/* a is not the same as b -- gradeschool long mult */
@@ -2461,13 +2461,13 @@
 
 			while (pb < pbend) {
 				carry += *pz + *pb++ * f;
-				*pz++ = (digit)(carry & MASK);
-				carry >>= SHIFT;
-				assert(carry <= MASK);
+				*pz++ = (digit)(carry & PyLong_MASK);
+				carry >>= PyLong_SHIFT;
+				assert(carry <= PyLong_MASK);
 			}
 			if (carry)
-				*pz += (digit)(carry & MASK);
-			assert((carry >> SHIFT) == 0);
+				*pz += (digit)(carry & PyLong_MASK);
+			assert((carry >> PyLong_SHIFT) == 0);
 		}
 	}
 	return long_normalize(z);
@@ -2485,7 +2485,7 @@
 {
 	PyLongObject *hi, *lo;
 	Py_ssize_t size_lo, size_hi;
-	const Py_ssize_t size_n = ABS(n->ob_size);
+	const Py_ssize_t size_n = ABS(Py_Size(n));
 
 	size_lo = MIN(size_n, size);
 	size_hi = size_n - size_lo;
@@ -2514,8 +2514,8 @@
 static PyLongObject *
 k_mul(PyLongObject *a, PyLongObject *b)
 {
-	Py_ssize_t asize = ABS(a->ob_size);
-	Py_ssize_t bsize = ABS(b->ob_size);
+	Py_ssize_t asize = ABS(Py_Size(a));
+	Py_ssize_t bsize = ABS(Py_Size(b));
 	PyLongObject *ah = NULL;
 	PyLongObject *al = NULL;
 	PyLongObject *bh = NULL;
@@ -2567,7 +2567,7 @@
 	/* Split a & b into hi & lo pieces. */
 	shift = bsize >> 1;
 	if (kmul_split(a, shift, &ah, &al) < 0) goto fail;
-	assert(ah->ob_size > 0);	/* the split isn't degenerate */
+	assert(Py_Size(ah) > 0);	/* the split isn't degenerate */
 
 	if (a == b) {
 		bh = ah;
@@ -2598,20 +2598,20 @@
 	if (ret == NULL) goto fail;
 #ifdef Py_DEBUG
 	/* Fill with trash, to catch reference to uninitialized digits. */
-	memset(ret->ob_digit, 0xDF, ret->ob_size * sizeof(digit));
+	memset(ret->ob_digit, 0xDF, Py_Size(ret) * sizeof(digit));
 #endif
 
 	/* 2. t1 <- ah*bh, and copy into high digits of result. */
 	if ((t1 = k_mul(ah, bh)) == NULL) goto fail;
-	assert(t1->ob_size >= 0);
-	assert(2*shift + t1->ob_size <= ret->ob_size);
+	assert(Py_Size(t1) >= 0);
+	assert(2*shift + Py_Size(t1) <= Py_Size(ret));
 	memcpy(ret->ob_digit + 2*shift, t1->ob_digit,
-	       t1->ob_size * sizeof(digit));
+	       Py_Size(t1) * sizeof(digit));
 
 	/* Zero-out the digits higher than the ah*bh copy. */
-	i = ret->ob_size - 2*shift - t1->ob_size;
+	i = Py_Size(ret) - 2*shift - Py_Size(t1);
 	if (i)
-		memset(ret->ob_digit + 2*shift + t1->ob_size, 0,
+		memset(ret->ob_digit + 2*shift + Py_Size(t1), 0,
 		       i * sizeof(digit));
 
 	/* 3. t2 <- al*bl, and copy into the low digits. */
@@ -2619,23 +2619,23 @@
 		Py_DECREF(t1);
 		goto fail;
 	}
-	assert(t2->ob_size >= 0);
-	assert(t2->ob_size <= 2*shift); /* no overlap with high digits */
-	memcpy(ret->ob_digit, t2->ob_digit, t2->ob_size * sizeof(digit));
+	assert(Py_Size(t2) >= 0);
+	assert(Py_Size(t2) <= 2*shift); /* no overlap with high digits */
+	memcpy(ret->ob_digit, t2->ob_digit, Py_Size(t2) * sizeof(digit));
 
 	/* Zero out remaining digits. */
-	i = 2*shift - t2->ob_size;	/* number of uninitialized digits */
+	i = 2*shift - Py_Size(t2);	/* number of uninitialized digits */
 	if (i)
-		memset(ret->ob_digit + t2->ob_size, 0, i * sizeof(digit));
+		memset(ret->ob_digit + Py_Size(t2), 0, i * sizeof(digit));
 
 	/* 4 & 5. Subtract ah*bh (t1) and al*bl (t2).  We do al*bl first
 	 * because it's fresher in cache.
 	 */
-	i = ret->ob_size - shift;  /* # digits after shift */
-	(void)v_isub(ret->ob_digit + shift, i, t2->ob_digit, t2->ob_size);
+	i = Py_Size(ret) - shift;  /* # digits after shift */
+	(void)v_isub(ret->ob_digit + shift, i, t2->ob_digit, Py_Size(t2));
 	Py_DECREF(t2);
 
-	(void)v_isub(ret->ob_digit + shift, i, t1->ob_digit, t1->ob_size);
+	(void)v_isub(ret->ob_digit + shift, i, t1->ob_digit, Py_Size(t1));
 	Py_DECREF(t1);
 
 	/* 6. t3 <- (ah+al)(bh+bl), and add into result. */
@@ -2660,12 +2660,12 @@
 	Py_DECREF(t1);
 	Py_DECREF(t2);
 	if (t3 == NULL) goto fail;
-	assert(t3->ob_size >= 0);
+	assert(Py_Size(t3) >= 0);
 
 	/* Add t3.  It's not obvious why we can't run out of room here.
 	 * See the (*) comment after this function.
 	 */
-	(void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, t3->ob_size);
+	(void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, Py_Size(t3));
 	Py_DECREF(t3);
 
 	return long_normalize(ret);
@@ -2713,7 +2713,7 @@
 (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits.  If asize < bsize,
 then we're asking whether asize digits >= f(bsize/2) digits + 2 bits.  By #4,
 asize is at least f(bsize/2)+1 digits, so this in turn reduces to whether 1
-digit is enough to hold 2 bits.  This is so since SHIFT=15 >= 2.  If
+digit is enough to hold 2 bits.  This is so since PyLong_SHIFT=15 >= 2.  If
 asize == bsize, then we're asking whether bsize digits is enough to hold
 c(bsize/2) digits + 2 bits, or equivalently (by #1) whether f(bsize/2) digits
 is enough to hold 2 bits.  This is so if bsize >= 2, which holds because
@@ -2735,8 +2735,8 @@
 static PyLongObject *
 k_lopsided_mul(PyLongObject *a, PyLongObject *b)
 {
-	const Py_ssize_t asize = ABS(a->ob_size);
-	Py_ssize_t bsize = ABS(b->ob_size);
+	const Py_ssize_t asize = ABS(Py_Size(a));
+	Py_ssize_t bsize = ABS(Py_Size(b));
 	Py_ssize_t nbdone;	/* # of b digits already multiplied */
 	PyLongObject *ret;
 	PyLongObject *bslice = NULL;
@@ -2748,7 +2748,7 @@
 	ret = _PyLong_New(asize + bsize);
 	if (ret == NULL)
 		return NULL;
-	memset(ret->ob_digit, 0, ret->ob_size * sizeof(digit));
+	memset(ret->ob_digit, 0, Py_Size(ret) * sizeof(digit));
 
 	/* Successive slices of b are copied into bslice. */
 	bslice = _PyLong_New(asize);
@@ -2763,14 +2763,14 @@
 		/* Multiply the next slice of b by a. */
 		memcpy(bslice->ob_digit, b->ob_digit + nbdone,
 		       nbtouse * sizeof(digit));
-		bslice->ob_size = nbtouse;
+		Py_Size(bslice) = nbtouse;
 		product = k_mul(a, bslice);
 		if (product == NULL)
 			goto fail;
 
 		/* Add into result. */
-		(void)v_iadd(ret->ob_digit + nbdone, ret->ob_size - nbdone,
-			     product->ob_digit, product->ob_size);
+		(void)v_iadd(ret->ob_digit + nbdone, Py_Size(ret) - nbdone,
+			     product->ob_digit, Py_Size(product));
 		Py_DECREF(product);
 
 		bsize -= nbtouse;
@@ -2796,7 +2796,7 @@
 		return Py_NotImplemented;
 	}
 
-	if (ABS(v->ob_size) <= 1 && ABS(w->ob_size) <= 1) {
+	if (ABS(Py_Size(v)) <= 1 && ABS(Py_Size(w)) <= 1) {
 		PyObject *r;
 		r = PyLong_FromLong(MEDIUM_VALUE(v)*MEDIUM_VALUE(w));
 		Py_DECREF(a);
@@ -2806,7 +2806,7 @@
 
 	z = k_mul(a, b);
 	/* Negate if exactly one of the inputs is negative. */
-	if (((a->ob_size ^ b->ob_size) < 0) && z)
+	if (((Py_Size(a) ^ Py_Size(b)) < 0) && z)
 		NEGATE(z);
 	Py_DECREF(a);
 	Py_DECREF(b);
@@ -2842,8 +2842,8 @@
 
 	if (long_divrem(v, w, &div, &mod) < 0)
 		return -1;
-	if ((mod->ob_size < 0 && w->ob_size > 0) ||
-	    (mod->ob_size > 0 && w->ob_size < 0)) {
+	if ((Py_Size(mod) < 0 && Py_Size(w) > 0) ||
+	    (Py_Size(mod) > 0 && Py_Size(w) < 0)) {
 		PyLongObject *temp;
 		PyLongObject *one;
 		temp = (PyLongObject *) long_add(mod, w);
@@ -2917,15 +2917,15 @@
 		return NULL;
 	}
 
-	/* True value is very close to ad/bd * 2**(SHIFT*(aexp-bexp)) */
+	/* True value is very close to ad/bd * 2**(PyLong_SHIFT*(aexp-bexp)) */
 	ad /= bd;	/* overflow/underflow impossible here */
 	aexp -= bexp;
-	if (aexp > INT_MAX / SHIFT)
+	if (aexp > INT_MAX / PyLong_SHIFT)
 		goto overflow;
-	else if (aexp < -(INT_MAX / SHIFT))
+	else if (aexp < -(INT_MAX / PyLong_SHIFT))
 		return PyFloat_FromDouble(0.0);	/* underflow to 0 */
 	errno = 0;
-	ad = ldexp(ad, aexp * SHIFT);
+	ad = ldexp(ad, aexp * PyLong_SHIFT);
 	if (Py_OVERFLOWED(ad)) /* ignore underflow to 0.0 */
 		goto overflow;
 	return PyFloat_FromDouble(ad);
@@ -3010,7 +3010,7 @@
 		return Py_NotImplemented;
 	}
 
-	if (b->ob_size < 0) {  /* if exponent is negative */
+	if (Py_Size(b) < 0) {  /* if exponent is negative */
 		if (c) {
 			PyErr_SetString(PyExc_TypeError, "pow() 2nd argument "
 			    "cannot be negative when 3rd argument specified");
@@ -3029,7 +3029,7 @@
 	if (c) {
 		/* if modulus == 0:
 		       raise ValueError() */
-		if (c->ob_size == 0) {
+		if (Py_Size(c) == 0) {
 			PyErr_SetString(PyExc_ValueError,
 					"pow() 3rd argument cannot be 0");
 			goto Error;
@@ -3038,7 +3038,7 @@
 		/* if modulus < 0:
 		       negativeOutput = True
 		       modulus = -modulus */
-		if (c->ob_size < 0) {
+		if (Py_Size(c) < 0) {
 			negativeOutput = 1;
 			temp = (PyLongObject *)_PyLong_Copy(c);
 			if (temp == NULL)
@@ -3051,7 +3051,7 @@
 
 		/* if modulus == 1:
 		       return 0 */
-		if ((c->ob_size == 1) && (c->ob_digit[0] == 1)) {
+		if ((Py_Size(c) == 1) && (c->ob_digit[0] == 1)) {
 			z = (PyLongObject *)PyLong_FromLong(0L);
 			goto Done;
 		}
@@ -3059,7 +3059,7 @@
 		/* if base < 0:
 		       base = base % modulus
 		   Having the base positive just makes things easier. */
-		if (a->ob_size < 0) {
+		if (Py_Size(a) < 0) {
 			if (l_divmod(a, c, NULL, &temp) < 0)
 				goto Error;
 			Py_DECREF(a);
@@ -3100,13 +3100,13 @@
 	REDUCE(result)					\
 }
 
-	if (b->ob_size <= FIVEARY_CUTOFF) {
+	if (Py_Size(b) <= FIVEARY_CUTOFF) {
 		/* Left-to-right binary exponentiation (HAC Algorithm 14.79) */
 		/* http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf    */
-		for (i = b->ob_size - 1; i >= 0; --i) {
+		for (i = Py_Size(b) - 1; i >= 0; --i) {
 			digit bi = b->ob_digit[i];
 
-			for (j = 1 << (SHIFT-1); j != 0; j >>= 1) {
+			for (j = 1 << (PyLong_SHIFT-1); j != 0; j >>= 1) {
 				MULT(z, z, z)
 				if (bi & j)
 					MULT(z, a, z)
@@ -3120,10 +3120,10 @@
 		for (i = 1; i < 32; ++i)
 			MULT(table[i-1], a, table[i])
 
-		for (i = b->ob_size - 1; i >= 0; --i) {
+		for (i = Py_Size(b) - 1; i >= 0; --i) {
 			const digit bi = b->ob_digit[i];
 
-			for (j = SHIFT - 5; j >= 0; j -= 5) {
+			for (j = PyLong_SHIFT - 5; j >= 0; j -= 5) {
 				const int index = (bi >> j) & 0x1f;
 				for (k = 0; k < 5; ++k)
 					MULT(z, z, z)
@@ -3133,7 +3133,7 @@
 		}
 	}
 
-	if (negativeOutput && (z->ob_size != 0)) {
+	if (negativeOutput && (Py_Size(z) != 0)) {
 		temp = (PyLongObject *)long_sub(z, c);
 		if (temp == NULL)
 			goto Error;
@@ -3150,7 +3150,7 @@
  	}
 	/* fall through */
  Done:
-	if (b->ob_size > FIVEARY_CUTOFF) {
+	if (Py_Size(b) > FIVEARY_CUTOFF) {
 		for (i = 0; i < 32; ++i)
 			Py_XDECREF(table[i]);
 	}
@@ -3167,7 +3167,7 @@
 	/* Implement ~x as -(x+1) */
 	PyLongObject *x;
 	PyLongObject *w;
-	if (ABS(v->ob_size) <=1)
+	if (ABS(Py_Size(v)) <=1)
 		return PyLong_FromLong(-(MEDIUM_VALUE(v)+1));
 	w = (PyLongObject *)PyLong_FromLong(1L);
 	if (w == NULL)
@@ -3176,7 +3176,7 @@
 	Py_DECREF(w);
 	if (x == NULL)
 		return NULL;
-	x->ob_size = -(x->ob_size);
+	Py_Size(x) = -(Py_Size(x));
 	return (PyObject *)x;
 }
 
@@ -3195,18 +3195,18 @@
 long_neg(PyLongObject *v)
 {
 	PyLongObject *z;
-	if (ABS(v->ob_size) <= 1)
+	if (ABS(Py_Size(v)) <= 1)
 		return PyLong_FromLong(-MEDIUM_VALUE(v));
 	z = (PyLongObject *)_PyLong_Copy(v);
 	if (z != NULL)
-		z->ob_size = -(v->ob_size);
+		Py_Size(z) = -(Py_Size(v));
 	return (PyObject *)z;
 }
 
 static PyObject *
 long_abs(PyLongObject *v)
 {
-	if (v->ob_size < 0)
+	if (Py_Size(v) < 0)
 		return long_neg(v);
 	else
 		return long_pos(v);
@@ -3215,7 +3215,7 @@
 static int
 long_bool(PyLongObject *v)
 {
-	return ABS(v->ob_size) != 0;
+	return ABS(Py_Size(v)) != 0;
 }
 
 static PyObject *
@@ -3229,7 +3229,7 @@
 
 	CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b);
 
-	if (a->ob_size < 0) {
+	if (Py_Size(a) < 0) {
 		/* Right shifting negative numbers is harder */
 		PyLongObject *a1, *a2;
 		a1 = (PyLongObject *) long_invert(a);
@@ -3252,23 +3252,23 @@
 					"negative shift count");
 			goto rshift_error;
 		}
-		wordshift = shiftby / SHIFT;
-		newsize = ABS(a->ob_size) - wordshift;
+		wordshift = shiftby / PyLong_SHIFT;
+		newsize = ABS(Py_Size(a)) - wordshift;
 		if (newsize <= 0) {
 			z = _PyLong_New(0);
 			Py_DECREF(a);
 			Py_DECREF(b);
 			return (PyObject *)z;
 		}
-		loshift = shiftby % SHIFT;
-		hishift = SHIFT - loshift;
+		loshift = shiftby % PyLong_SHIFT;
+		hishift = PyLong_SHIFT - loshift;
 		lomask = ((digit)1 << hishift) - 1;
-		himask = MASK ^ lomask;
+		himask = PyLong_MASK ^ lomask;
 		z = _PyLong_New(newsize);
 		if (z == NULL)
 			goto rshift_error;
-		if (a->ob_size < 0)
-			z->ob_size = -(z->ob_size);
+		if (Py_Size(a) < 0)
+			Py_Size(z) = -(Py_Size(z));
 		for (i = 0, j = wordshift; i < newsize; i++, j++) {
 			z->ob_digit[i] = (a->ob_digit[j] >> loshift) & lomask;
 			if (i+1 < newsize)
@@ -3308,26 +3308,26 @@
 				"outrageous left shift count");
 		goto lshift_error;
 	}
-	/* wordshift, remshift = divmod(shiftby, SHIFT) */
-	wordshift = (int)shiftby / SHIFT;
-	remshift  = (int)shiftby - wordshift * SHIFT;
+	/* wordshift, remshift = divmod(shiftby, PyLong_SHIFT) */
+	wordshift = (int)shiftby / PyLong_SHIFT;
+	remshift  = (int)shiftby - wordshift * PyLong_SHIFT;
 
-	oldsize = ABS(a->ob_size);
+	oldsize = ABS(Py_Size(a));
 	newsize = oldsize + wordshift;
 	if (remshift)
 		++newsize;
 	z = _PyLong_New(newsize);
 	if (z == NULL)
 		goto lshift_error;
-	if (a->ob_size < 0)
+	if (Py_Size(a) < 0)
 		NEGATE(z);
 	for (i = 0; i < wordshift; i++)
 		z->ob_digit[i] = 0;
 	accum = 0;
 	for (i = wordshift, j = 0; j < oldsize; i++, j++) {
 		accum |= (twodigits)a->ob_digit[j] << remshift;
-		z->ob_digit[i] = (digit)(accum & MASK);
-		accum >>= SHIFT;
+		z->ob_digit[i] = (digit)(accum & PyLong_MASK);
+		accum >>= PyLong_SHIFT;
 	}
 	if (remshift)
 		z->ob_digit[newsize-1] = (digit)accum;
@@ -3348,7 +3348,7 @@
 	     int op,  /* '&', '|', '^' */
 	     PyLongObject *b)
 {
-	digit maska, maskb; /* 0 or MASK */
+	digit maska, maskb; /* 0 or PyLong_MASK */
 	int negz;
 	Py_ssize_t size_a, size_b, size_z;
 	PyLongObject *z;
@@ -3356,23 +3356,23 @@
 	digit diga, digb;
 	PyObject *v;
 
-	if (a->ob_size < 0) {
+	if (Py_Size(a) < 0) {
 		a = (PyLongObject *) long_invert(a);
 		if (a == NULL)
 			return NULL;
-		maska = MASK;
+		maska = PyLong_MASK;
 	}
 	else {
 		Py_INCREF(a);
 		maska = 0;
 	}
-	if (b->ob_size < 0) {
+	if (Py_Size(b) < 0) {
 		b = (PyLongObject *) long_invert(b);
 		if (b == NULL) {
 			Py_DECREF(a);
 			return NULL;
 		}
-		maskb = MASK;
+		maskb = PyLong_MASK;
 	}
 	else {
 		Py_INCREF(b);
@@ -3383,23 +3383,23 @@
 	switch (op) {
 	case '^':
 		if (maska != maskb) {
-			maska ^= MASK;
+			maska ^= PyLong_MASK;
 			negz = -1;
 		}
 		break;
 	case '&':
 		if (maska && maskb) {
 			op = '|';
-			maska ^= MASK;
-			maskb ^= MASK;
+			maska ^= PyLong_MASK;
+			maskb ^= PyLong_MASK;
 			negz = -1;
 		}
 		break;
 	case '|':
 		if (maska || maskb) {
 			op = '&';
-			maska ^= MASK;
-			maskb ^= MASK;
+			maska ^= PyLong_MASK;
+			maskb ^= PyLong_MASK;
 			negz = -1;
 		}
 		break;
@@ -3415,8 +3415,8 @@
 	   whose length should be ignored.
 	*/
 
-	size_a = a->ob_size;
-	size_b = b->ob_size;
+	size_a = Py_Size(a);
+	size_b = Py_Size(b);
 	size_z = op == '&'
 		? (maska
 		   ? size_b
@@ -3585,7 +3585,7 @@
 	if (tmp == NULL)
 		return NULL;
 	assert(PyLong_CheckExact(tmp));
-	n = tmp->ob_size;
+	n = Py_Size(tmp);
 	if (n < 0)
 		n = -n;
 	newobj = (PyLongObject *)type->tp_alloc(type, n);
@@ -3594,7 +3594,7 @@
 		return NULL;
 	}
 	assert(PyLong_Check(newobj));
-	newobj->ob_size = tmp->ob_size;
+	Py_Size(newobj) = Py_Size(tmp);
 	for (i = 0; i < n; i++)
 		newobj->ob_digit[i] = tmp->ob_digit[i];
 	Py_DECREF(tmp);
@@ -3662,8 +3662,7 @@
 };
 
 PyTypeObject PyLong_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"int",					/* tp_name */
 	/* See _PyLong_New for why this isn't
 	   sizeof(PyLongObject) - sizeof(digit) */
@@ -3715,12 +3714,12 @@
 	PyLongObject *v = small_ints;
 	for (ival = -NSMALLNEGINTS; ival < 0; ival++, v++) {
 		PyObject_INIT(v, &PyLong_Type);
-		v->ob_size = -1;
+		Py_Size(v) = -1;
 		v->ob_digit[0] = -ival;
 	}
 	for (; ival < NSMALLPOSINTS; ival++, v++) {
 		PyObject_INIT(v, &PyLong_Type);
-		v->ob_size = ival ? 1 : 0;
+		Py_Size(v) = ival ? 1 : 0;
 		v->ob_digit[0] = ival;
 	}
 #endif

Modified: python/branches/py3k-struni/Objects/methodobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/methodobject.c	(original)
+++ python/branches/py3k-struni/Objects/methodobject.c	Sat Jul 21 19:22:18 2007
@@ -241,8 +241,7 @@
 
 
 PyTypeObject PyCFunction_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"builtin_function_or_method",
 	sizeof(PyCFunctionObject),
 	0,

Modified: python/branches/py3k-struni/Objects/moduleobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/moduleobject.c	(original)
+++ python/branches/py3k-struni/Objects/moduleobject.c	Sat Jul 21 19:22:18 2007
@@ -181,7 +181,7 @@
 		_PyModule_Clear((PyObject *)m);
 		Py_DECREF(m->md_dict);
 	}
-	m->ob_type->tp_free((PyObject *)m);
+	Py_Type(m)->tp_free((PyObject *)m);
 }
 
 static PyObject *
@@ -220,8 +220,7 @@
 The name must be a string; the optional doc argument can have any type.");
 
 PyTypeObject PyModule_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"module",				/* tp_name */
 	sizeof(PyModuleObject),			/* tp_size */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/object.c
==============================================================================
--- python/branches/py3k-struni/Objects/object.c	(original)
+++ python/branches/py3k-struni/Objects/object.c	Sat Jul 21 19:22:18 2007
@@ -214,7 +214,7 @@
 	if (op == NULL)
 		return PyErr_NoMemory();
 	/* Any changes should be reflected in PyObject_INIT (objimpl.h) */
-	op->ob_type = tp;
+	Py_Type(op) = tp;
 	_Py_NewReference(op);
 	return op;
 }
@@ -226,7 +226,7 @@
 		return (PyVarObject *) PyErr_NoMemory();
 	/* Any changes should be reflected in PyObject_INIT_VAR */
 	op->ob_size = size;
-	op->ob_type = tp;
+	Py_Type(op) = tp;
 	_Py_NewReference((PyObject *)op);
 	return op;
 }
@@ -279,7 +279,7 @@
 			   universally available */
 			fprintf(fp, "<refcnt %ld at %p>",
 				(long)op->ob_refcnt, op);
-		else if (op->ob_type->tp_print == NULL) {
+		else if (Py_Type(op)->tp_print == NULL) {
 			PyObject *s;
 			if (flags & Py_PRINT_RAW)
 				s = PyObject_Str(op);
@@ -294,7 +294,7 @@
 			Py_XDECREF(s);
 		}
 		else
-			ret = (*op->ob_type->tp_print)(op, fp, flags);
+			ret = (*Py_Type(op)->tp_print)(op, fp, flags);
 	}
 	if (ret == 0) {
 		if (ferror(fp)) {
@@ -334,7 +334,7 @@
 			"type    : %s\n"
 			"refcount: %ld\n"
 			"address : %p\n",
-			op->ob_type==NULL ? "NULL" : op->ob_type->tp_name,
+			Py_Type(op)==NULL ? "NULL" : Py_Type(op)->tp_name,
 			(long)op->ob_refcnt,
 			op);
 	}
@@ -354,7 +354,7 @@
 #endif
 	if (v == NULL)
 		return PyUnicode_FromString("<NULL>");
-	else if (v->ob_type->tp_repr == NULL)
+	else if (Py_Type(v)->tp_repr == NULL)
 		return PyUnicode_FromFormat("<%s object at %p>", v->ob_type->tp_name, v);
 	else {
 		ress = (*v->ob_type->tp_repr)(v);
@@ -408,16 +408,16 @@
 		Py_INCREF(v);
 		return v;
 	}
-	if (v->ob_type->tp_str == NULL)
+	if (Py_Type(v)->tp_str == NULL)
 		return PyObject_Repr(v);
 
-	res = (*v->ob_type->tp_str)(v);
+	res = (*Py_Type(v)->tp_str)(v);
 	if (res == NULL)
 		return NULL;
 	if (!(PyString_Check(res) || PyUnicode_Check(res))) {
 		PyErr_Format(PyExc_TypeError,
 			     "__str__ returned non-string (type %.200s)",
-			     res->ob_type->tp_name);
+			     Py_Type(res)->tp_name);
 		Py_DECREF(res);
 		return NULL;
 	}
@@ -486,8 +486,8 @@
 			res = v;
 		}
 		else {
-			if (v->ob_type->tp_str != NULL)
-				res = (*v->ob_type->tp_str)(v);
+			if (Py_Type(v)->tp_str != NULL)
+				res = (*Py_Type(v)->tp_str)(v);
 			else
 				res = PyObject_Repr(v);
 		}
@@ -849,8 +849,8 @@
 {
 	PyObject *w, *res;
 
-	if (v->ob_type->tp_getattr != NULL)
-		return (*v->ob_type->tp_getattr)(v, (char*)name);
+	if (Py_Type(v)->tp_getattr != NULL)
+		return (*Py_Type(v)->tp_getattr)(v, (char*)name);
 	w = PyUnicode_InternFromString(name);
 	if (w == NULL)
 		return NULL;
@@ -877,8 +877,8 @@
 	PyObject *s;
 	int res;
 
-	if (v->ob_type->tp_setattr != NULL)
-		return (*v->ob_type->tp_setattr)(v, (char*)name, w);
+	if (Py_Type(v)->tp_setattr != NULL)
+		return (*Py_Type(v)->tp_setattr)(v, (char*)name, w);
 	s = PyUnicode_InternFromString(name);
 	if (s == NULL)
 		return -1;
@@ -890,9 +890,9 @@
 PyObject *
 PyObject_GetAttr(PyObject *v, PyObject *name)
 {
-	PyTypeObject *tp = v->ob_type;
+	PyTypeObject *tp = Py_Type(v);
 
-	if (!PyUnicode_Check(name)) {
+ 	if (!PyUnicode_Check(name)) {
 		PyErr_Format(PyExc_TypeError,
 			     "attribute name must be string, not '%.200s'",
 			     name->ob_type->tp_name);
@@ -923,7 +923,7 @@
 int
 PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
 {
-	PyTypeObject *tp = v->ob_type;
+	PyTypeObject *tp = Py_Type(v);
 	int err;
 
 	if (!PyUnicode_Check(name)) {
@@ -970,7 +970,7 @@
 _PyObject_GetDictPtr(PyObject *obj)
 {
 	Py_ssize_t dictoffset;
-	PyTypeObject *tp = obj->ob_type;
+	PyTypeObject *tp = Py_Type(obj);
 
 	dictoffset = tp->tp_dictoffset;
 	if (dictoffset == 0)
@@ -1003,7 +1003,7 @@
 PyObject *
 PyObject_GenericGetAttr(PyObject *obj, PyObject *name)
 {
-	PyTypeObject *tp = obj->ob_type;
+	PyTypeObject *tp = Py_Type(obj);
 	PyObject *descr = NULL;
 	PyObject *res = NULL;
 	descrgetfunc f;
@@ -1087,7 +1087,7 @@
 	}
 
 	if (f != NULL) {
-		res = f(descr, obj, (PyObject *)obj->ob_type);
+		res = f(descr, obj, (PyObject *)Py_Type(obj));
 		Py_DECREF(descr);
 		goto done;
 	}
@@ -1109,7 +1109,7 @@
 int
 PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value)
 {
-	PyTypeObject *tp = obj->ob_type;
+	PyTypeObject *tp = Py_Type(obj);
 	PyObject *descr;
 	descrsetfunc f;
 	PyObject **dictptr;
@@ -1309,7 +1309,7 @@
 	if (!PyList_Check(names)) {
 		PyErr_Format(PyExc_TypeError,
 			"dir(): expected keys() of locals to be a list, "
-			"not '%.200s'", names->ob_type->tp_name);
+			"not '%.200s'", Py_Type(names)->tp_name);
 		Py_DECREF(names);
 		return NULL;
 	}
@@ -1437,7 +1437,7 @@
 		if (!PyList_Check(result)) {
 			PyErr_Format(PyExc_TypeError,
 				     "__dir__() must return a list, not %.200s",
-				     result->ob_type->tp_name);
+				     Py_Type(result)->tp_name);
 			Py_DECREF(result);
 			result = NULL;
 		}
@@ -1499,8 +1499,7 @@
 
 
 static PyTypeObject PyNone_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"NoneType",
 	0,
 	0,
@@ -1517,7 +1516,8 @@
 };
 
 PyObject _Py_NoneStruct = {
-	PyObject_HEAD_INIT(&PyNone_Type)
+  _PyObject_EXTRA_INIT
+  1, &PyNone_Type
 };
 
 /* NotImplemented is an object that can be used to signal that an
@@ -1530,8 +1530,7 @@
 }
 
 static PyTypeObject PyNotImplemented_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"NotImplementedType",
 	0,
 	0,
@@ -1548,7 +1547,8 @@
 };
 
 PyObject _Py_NotImplementedStruct = {
-	PyObject_HEAD_INIT(&PyNotImplemented_Type)
+	_PyObject_EXTRA_INIT
+	1, &PyNotImplemented_Type
 };
 
 void
@@ -1625,7 +1625,7 @@
 void
 _Py_Dealloc(PyObject *op)
 {
-	destructor dealloc = op->ob_type->tp_dealloc;
+	destructor dealloc = Py_Type(op)->tp_dealloc;
 	_Py_ForgetReference(op);
 	(*dealloc)(op);
 }
@@ -1656,7 +1656,7 @@
 	fprintf(fp, "Remaining object addresses:\n");
 	for (op = refchain._ob_next; op != &refchain; op = op->_ob_next)
 		fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", op,
-			op->ob_refcnt, op->ob_type->tp_name);
+			op->ob_refcnt, Py_Type(op)->tp_name);
 }
 
 PyObject *
@@ -1674,7 +1674,7 @@
 		return NULL;
 	for (i = 0; (n == 0 || i < n) && op != &refchain; i++) {
 		while (op == self || op == args || op == res || op == t ||
-		       (t != NULL && op->ob_type != (PyTypeObject *) t)) {
+		       (t != NULL && Py_Type(op) != (PyTypeObject *) t)) {
 			op = op->_ob_next;
 			if (op == &refchain)
 				return res;
@@ -1817,7 +1817,7 @@
 {
 	while (_PyTrash_delete_later) {
 		PyObject *op = _PyTrash_delete_later;
-		destructor dealloc = op->ob_type->tp_dealloc;
+		destructor dealloc = Py_Type(op)->tp_dealloc;
 
 		_PyTrash_delete_later =
 			(PyObject*) _Py_AS_GC(op)->gc.gc_prev;

Modified: python/branches/py3k-struni/Objects/obmalloc.c
==============================================================================
--- python/branches/py3k-struni/Objects/obmalloc.c	(original)
+++ python/branches/py3k-struni/Objects/obmalloc.c	Sat Jul 21 19:22:18 2007
@@ -675,8 +675,8 @@
 /* This is only useful when running memory debuggers such as
  * Purify or Valgrind.  Uncomment to use.
  *
-#define Py_USING_MEMORY_DEBUGGER
  */
+#define Py_USING_MEMORY_DEBUGGER
 
 #ifdef Py_USING_MEMORY_DEBUGGER
 

Modified: python/branches/py3k-struni/Objects/rangeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/rangeobject.c	(original)
+++ python/branches/py3k-struni/Objects/rangeobject.c	Sat Jul 21 19:22:18 2007
@@ -272,8 +272,7 @@
 };
 
 PyTypeObject PyRange_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,			/* Number of items for varobject */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"range",		/* Name of this type */
 	sizeof(rangeobject),	/* Basic object size */
 	0,			/* Item size for varobject */
@@ -368,8 +367,7 @@
 };
 
 PyTypeObject Pyrangeiter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,                                      /* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"rangeiterator",                        /* tp_name */
 	sizeof(rangeiterobject),                /* tp_basicsize */
 	0,                                      /* tp_itemsize */
@@ -520,8 +518,7 @@
 }
 
 static PyTypeObject Pylongrangeiter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,                                      /* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"rangeiterator",                        /* tp_name */
 	sizeof(longrangeiterobject),            /* tp_basicsize */
 	0,                                      /* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/setobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/setobject.c	(original)
+++ python/branches/py3k-struni/Objects/setobject.c	Sat Jul 21 19:22:18 2007
@@ -3,7 +3,7 @@
    Written and maintained by Raymond D. Hettinger <python at rcn.com>
    Derived from Lib/sets.py and Objects/dictobject.c.
 
-   Copyright (c) 2003-6 Python Software Foundation.
+   Copyright (c) 2003-2007 Python Software Foundation.
    All rights reserved.
 */
 
@@ -561,7 +561,7 @@
 	if (num_free_sets < MAXFREESETS && PyAnySet_CheckExact(so))
 		free_sets[num_free_sets++] = so;
 	else 
-		so->ob_type->tp_free(so);
+		Py_Type(so)->tp_free(so);
 	Py_TRASHCAN_SAFE_END(so)
 }
 
@@ -578,21 +578,21 @@
 	if (status != 0) {
 		if (status < 0)
 			return status;
-		fprintf(fp, "%s(...)", so->ob_type->tp_name);
+		fprintf(fp, "%s(...)", Py_Type(so)->tp_name);
 		return 0;
 	}        
 
 	if (!so->used) {
 		Py_ReprLeave((PyObject*)so);
-		fprintf(fp, "%s()", so->ob_type->tp_name);
+		fprintf(fp, "%s()", Py_Type(so)->tp_name);
 		return 0;
 	}
 
-	if (so->ob_type == &PySet_Type) {
+	if (Py_Type(so) == &PySet_Type) {
 		literalform = 1;
 		fprintf(fp, "{");
 	} else
-		fprintf(fp, "%s([", so->ob_type->tp_name);
+		fprintf(fp, "%s([", Py_Type(so)->tp_name);
 	while (set_next(so, &pos, &entry)) {
 		fputs(emit, fp);
 		emit = separator;
@@ -892,8 +892,7 @@
 }
 
 static PyTypeObject PySetIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"setiterator",				/* tp_name */
 	sizeof(setiterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -1019,7 +1018,7 @@
 	    (type == &PySet_Type  ||  type == &PyFrozenSet_Type)) {
 		so = free_sets[--num_free_sets];
 		assert (so != NULL && PyAnySet_CheckExact(so));
-		so->ob_type = type;
+		Py_Type(so) = type;
 		_Py_NewReference((PyObject *)so);
 		EMPTY_TO_MINSIZE(so);
 		PyObject_GC_Track(so);
@@ -1145,8 +1144,8 @@
 		memcpy(b->smalltable, tab, sizeof(tab));
 	}
 
-	if (PyType_IsSubtype(a->ob_type, &PyFrozenSet_Type)  &&
-	    PyType_IsSubtype(b->ob_type, &PyFrozenSet_Type)) {
+	if (PyType_IsSubtype(Py_Type(a), &PyFrozenSet_Type)  &&
+	    PyType_IsSubtype(Py_Type(b), &PyFrozenSet_Type)) {
 		h = a->hash;     a->hash = b->hash;  b->hash = h;
 	} else {
 		a->hash = -1;
@@ -1157,7 +1156,7 @@
 static PyObject *
 set_copy(PySetObject *so)
 {
-	return make_new_set(so->ob_type, (PyObject *)so);
+	return make_new_set(Py_Type(so), (PyObject *)so);
 }
 
 static PyObject *
@@ -1235,7 +1234,7 @@
 	if ((PyObject *)so == other)
 		return set_copy(so);
 
-	result = (PySetObject *)make_new_set(so->ob_type, NULL);
+	result = (PySetObject *)make_new_set(Py_Type(so), NULL);
 	if (result == NULL)
 		return NULL;
 
@@ -1422,7 +1421,7 @@
 		return NULL;
 	}
 	
-	result = make_new_set(so->ob_type, NULL);
+	result = make_new_set(Py_Type(so), NULL);
 	if (result == NULL)
 		return NULL;
 
@@ -1523,7 +1522,7 @@
 		Py_INCREF(other);
 		otherset = (PySetObject *)other;
 	} else {
-		otherset = (PySetObject *)make_new_set(so->ob_type, other);
+		otherset = (PySetObject *)make_new_set(Py_Type(so), other);
 		if (otherset == NULL)
 			return NULL;
 	}
@@ -1554,7 +1553,7 @@
 	PyObject *rv;
 	PySetObject *otherset;
 
-	otherset = (PySetObject *)make_new_set(so->ob_type, other);
+	otherset = (PySetObject *)make_new_set(Py_Type(so), other);
 	if (otherset == NULL)
 		return NULL;
 	rv = set_symmetric_difference_update(otherset, (PyObject *)so);
@@ -1821,7 +1820,7 @@
 		dict = Py_None;
 		Py_INCREF(dict);
 	}
-	result = PyTuple_Pack(3, so->ob_type, args, dict);
+	result = PyTuple_Pack(3, Py_Type(so), args, dict);
 done:
 	Py_XDECREF(args);
 	Py_XDECREF(keys);
@@ -1838,7 +1837,7 @@
 
 	if (!PyAnySet_Check(self))
 		return -1;
-	if (!PyArg_UnpackTuple(args, self->ob_type->tp_name, 0, 1, &iterable))
+	if (!PyArg_UnpackTuple(args, Py_Type(self)->tp_name, 0, 1, &iterable))
 		return -1;
 	set_clear_internal(self);
 	self->hash = -1;
@@ -1952,8 +1951,7 @@
 Build an unordered collection of unique elements.");
 
 PyTypeObject PySet_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"set",				/* tp_name */
 	sizeof(PySetObject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2046,8 +2044,7 @@
 Build an immutable unordered collection of unique elements.");
 
 PyTypeObject PyFrozenSet_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"frozenset",			/* tp_name */
 	sizeof(PySetObject),		/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -2128,7 +2125,7 @@
 int
 PySet_Clear(PyObject *set)
 {
-	if (!PyType_IsSubtype(set->ob_type, &PySet_Type)) {
+	if (!PyType_IsSubtype(Py_Type(set), &PySet_Type)) {
 		PyErr_BadInternalCall();
 		return -1;
 	}
@@ -2148,7 +2145,7 @@
 int
 PySet_Discard(PyObject *set, PyObject *key)
 {
-	if (!PyType_IsSubtype(set->ob_type, &PySet_Type)) {
+	if (!PyType_IsSubtype(Py_Type(set), &PySet_Type)) {
 		PyErr_BadInternalCall();
 		return -1;
 	}
@@ -2158,7 +2155,7 @@
 int
 PySet_Add(PyObject *set, PyObject *key)
 {
-	if (!PyType_IsSubtype(set->ob_type, &PySet_Type)) {
+	if (!PyType_IsSubtype(Py_Type(set), &PySet_Type)) {
 		PyErr_BadInternalCall();
 		return -1;
 	}
@@ -2199,7 +2196,7 @@
 PyObject *
 PySet_Pop(PyObject *set)
 {
-	if (!PyType_IsSubtype(set->ob_type, &PySet_Type)) {
+	if (!PyType_IsSubtype(Py_Type(set), &PySet_Type)) {
 		PyErr_BadInternalCall();
 		return NULL;
 	}
@@ -2209,7 +2206,7 @@
 int
 _PySet_Update(PyObject *set, PyObject *iterable)
 {
-	if (!PyType_IsSubtype(set->ob_type, &PySet_Type)) {
+	if (!PyType_IsSubtype(Py_Type(set), &PySet_Type)) {
 		PyErr_BadInternalCall();
 		return -1;
 	}

Modified: python/branches/py3k-struni/Objects/sliceobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/sliceobject.c	(original)
+++ python/branches/py3k-struni/Objects/sliceobject.c	Sat Jul 21 19:22:18 2007
@@ -23,8 +23,7 @@
 }
 
 static PyTypeObject PyEllipsis_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,				/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"ellipsis",			/* tp_name */
 	0,				/* tp_basicsize */
 	0,				/* tp_itemsize */
@@ -47,7 +46,8 @@
 };
 
 PyObject _Py_EllipsisObject = {
-	PyObject_HEAD_INIT(&PyEllipsis_Type)
+	_PyObject_EXTRA_INIT
+	1, &PyEllipsis_Type
 };
 
 
@@ -266,7 +266,7 @@
 static PyObject *
 slice_reduce(PySliceObject* self)
 {
-	return Py_BuildValue("O(OOO)", self->ob_type, self->start, self->stop, self->step);
+	return Py_BuildValue("O(OOO)", Py_Type(self), self->start, self->stop, self->step);
 }
 
 PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
@@ -338,8 +338,7 @@
 }
 
 PyTypeObject PySlice_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,			/* Number of items for varobject */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"slice",		/* Name of this type */
 	sizeof(PySliceObject),	/* Basic object size */
 	0,			/* Item size for varobject */

Modified: python/branches/py3k-struni/Objects/stringobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/stringobject.c	(original)
+++ python/branches/py3k-struni/Objects/stringobject.c	Sat Jul 21 19:22:18 2007
@@ -414,7 +414,7 @@
     if (!PyString_Check(v)) {
         PyErr_Format(PyExc_TypeError,
                      "decoder did not return a string object (type=%.400s)",
-                     v->ob_type->tp_name);
+                     Py_Type(v)->tp_name);
         Py_DECREF(v);
         goto onError;
     }
@@ -487,7 +487,7 @@
     if (!PyString_Check(v)) {
         PyErr_Format(PyExc_TypeError,
                      "encoder did not return a string object (type=%.400s)",
-                     v->ob_type->tp_name);
+                     Py_Type(v)->tp_name);
         Py_DECREF(v);
         goto onError;
     }
@@ -507,7 +507,7 @@
 
 		case SSTATE_INTERNED_MORTAL:
 			/* revive dead object temporarily for DelItem */
-			op->ob_refcnt = 3;
+			Py_Refcnt(op) = 3;
 			if (PyDict_DelItem(interned, op) != 0)
 				Py_FatalError(
 					"deletion of interned string failed");
@@ -519,7 +519,7 @@
 		default:
 			Py_FatalError("Inconsistent interned string state.");
 	}
-	op->ob_type->tp_free(op);
+	Py_Type(op)->tp_free(op);
 }
 
 /* Unescape a backslash-escaped string. If unicode is non-zero,
@@ -693,7 +693,7 @@
 	}
 	if (!PyString_Check(op))
 		return string_getsize(op);
-	return ((PyStringObject *)op) -> ob_size;
+	return Py_Size(op);
 }
 
 /*const*/ char *
@@ -729,7 +729,7 @@
 		{
 			PyErr_Format(PyExc_TypeError,
 				     "expected string, "
-				     "%.200s found", obj->ob_type->tp_name);
+				     "%.200s found", Py_Type(obj)->tp_name);
 			return -1;
 		}
 	}
@@ -784,7 +784,7 @@
 	}
 	if (flags & Py_PRINT_RAW) {
 		char *data = op->ob_sval;
-		Py_ssize_t size = op->ob_size;
+		Py_ssize_t size = Py_Size(op);
 		while (size > INT_MAX) {
 			/* Very long strings cannot be written atomically.
 			 * But don't write exactly INT_MAX bytes at a time
@@ -805,12 +805,12 @@
 
 	/* figure out which quote to use; single is preferred */
 	quote = '\'';
-	if (memchr(op->ob_sval, '\'', op->ob_size) &&
-	    !memchr(op->ob_sval, '"', op->ob_size))
+	if (memchr(op->ob_sval, '\'', Py_Size(op)) &&
+	    !memchr(op->ob_sval, '"', Py_Size(op)))
 		quote = '"';
 
 	fputc(quote, fp);
-	for (i = 0; i < op->ob_size; i++) {
+	for (i = 0; i < Py_Size(op); i++) {
 		c = op->ob_sval[i];
 		if (c == quote || c == '\\')
 			fprintf(fp, "\\%c", c);
@@ -837,7 +837,7 @@
 	Py_ssize_t length = PyString_GET_SIZE(op);
 	size_t newsize = 3 + 4 * op->ob_size;
 	PyObject *v;
-	if (newsize > PY_SSIZE_T_MAX || newsize / 4 != op->ob_size) {
+	if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(op)) {
 		PyErr_SetString(PyExc_OverflowError,
 			"string is too large to make repr");
 	}
@@ -869,7 +869,7 @@
 		}
 
 		*p++ = 's', *p++ = quote;
-		for (i = 0; i < op->ob_size; i++) {
+		for (i = 0; i < Py_Size(op); i++) {
 			/* There's at least enough room for a hex escape
 			   and a closing quote. */
 			assert(newsize - (p - PyUnicode_AS_UNICODE(v)) >= 5);
@@ -919,14 +919,14 @@
 	else {
 		/* Subtype -- return genuine string with the same value. */
 		PyStringObject *t = (PyStringObject *) s;
-		return PyString_FromStringAndSize(t->ob_sval, t->ob_size);
+		return PyString_FromStringAndSize(t->ob_sval, Py_Size(t));
 	}
 }
 
 static Py_ssize_t
 string_length(PyStringObject *a)
 {
-	return a->ob_size;
+	return Py_Size(a);
 }
 
 static PyObject *
@@ -941,21 +941,21 @@
 			return PyBytes_Concat((PyObject *)a, bb);
 		PyErr_Format(PyExc_TypeError,
 			     "cannot concatenate 'str8' and '%.200s' objects",
-			     bb->ob_type->tp_name);
+			     Py_Type(bb)->tp_name);
 		return NULL;
 	}
 #define b ((PyStringObject *)bb)
 	/* Optimize cases with empty left or right operand */
-	if ((a->ob_size == 0 || b->ob_size == 0) &&
+	if ((Py_Size(a) == 0 || Py_Size(b) == 0) &&
 	    PyString_CheckExact(a) && PyString_CheckExact(b)) {
-		if (a->ob_size == 0) {
+		if (Py_Size(a) == 0) {
 			Py_INCREF(bb);
 			return bb;
 		}
 		Py_INCREF(a);
 		return (PyObject *)a;
 	}
-	size = a->ob_size + b->ob_size;
+	size = Py_Size(a) + Py_Size(b);
 	if (size < 0) {
 		PyErr_SetString(PyExc_OverflowError,
 				"strings are too large to concat");
@@ -969,8 +969,8 @@
 	PyObject_INIT_VAR(op, &PyString_Type, size);
 	op->ob_shash = -1;
 	op->ob_sstate = SSTATE_NOT_INTERNED;
-	Py_MEMCPY(op->ob_sval, a->ob_sval, a->ob_size);
-	Py_MEMCPY(op->ob_sval + a->ob_size, b->ob_sval, b->ob_size);
+	Py_MEMCPY(op->ob_sval, a->ob_sval, Py_Size(a));
+	Py_MEMCPY(op->ob_sval + Py_Size(a), b->ob_sval, Py_Size(b));
 	op->ob_sval[size] = '\0';
 	return (PyObject *) op;
 #undef b
@@ -989,13 +989,13 @@
 	/* watch out for overflows:  the size can overflow int,
 	 * and the # of bytes needed can overflow size_t
 	 */
-	size = a->ob_size * n;
-	if (n && size / n != a->ob_size) {
+	size = Py_Size(a) * n;
+	if (n && size / n != Py_Size(a)) {
 		PyErr_SetString(PyExc_OverflowError,
 			"repeated string is too long");
 		return NULL;
 	}
-	if (size == a->ob_size && PyString_CheckExact(a)) {
+	if (size == Py_Size(a) && PyString_CheckExact(a)) {
 		Py_INCREF(a);
 		return (PyObject *)a;
 	}
@@ -1013,14 +1013,14 @@
 	op->ob_shash = -1;
 	op->ob_sstate = SSTATE_NOT_INTERNED;
 	op->ob_sval[size] = '\0';
-	if (a->ob_size == 1 && n > 0) {
+	if (Py_Size(a) == 1 && n > 0) {
 		memset(op->ob_sval, a->ob_sval[0] , n);
 		return (PyObject *) op;
 	}
 	i = 0;
 	if (i < size) {
-		Py_MEMCPY(op->ob_sval, a->ob_sval, a->ob_size);
-		i = a->ob_size;
+		Py_MEMCPY(op->ob_sval, a->ob_sval, Py_Size(a));
+		i = Py_Size(a);
 	}
 	while (i < size) {
 		j = (i <= size-i)  ?  i  :  size-i;
@@ -1041,9 +1041,9 @@
 		i = 0;
 	if (j < 0)
 		j = 0; /* Avoid signed/unsigned bug in next line */
-	if (j > a->ob_size)
-		j = a->ob_size;
-	if (i == 0 && j == a->ob_size && PyString_CheckExact(a)) {
+	if (j > Py_Size(a))
+		j = Py_Size(a);
+	if (i == 0 && j == Py_Size(a) && PyString_CheckExact(a)) {
 		/* It's the same as a */
 		Py_INCREF(a);
 		return (PyObject *)a;
@@ -1062,7 +1062,7 @@
 		if (!PyString_Check(sub_obj)) {
 			PyErr_Format(PyExc_TypeError,
 			    "'in <string>' requires string as left operand, "
-			    "not %.200s", sub_obj->ob_type->tp_name);
+			    "not %.200s", Py_Type(sub_obj)->tp_name);
 			return -1;
 		}
 	}
@@ -1075,7 +1075,7 @@
 {
 	char pchar;
 	PyObject *v;
-	if (i < 0 || i >= a->ob_size) {
+	if (i < 0 || i >= Py_Size(a)) {
 		PyErr_SetString(PyExc_IndexError, "string index out of range");
 		return NULL;
 	}
@@ -1118,16 +1118,16 @@
 	if (op == Py_EQ) {
 		/* Supporting Py_NE here as well does not save
 		   much time, since Py_NE is rarely used.  */
-		if (a->ob_size == b->ob_size
+		if (Py_Size(a) == Py_Size(b)
 		    && (a->ob_sval[0] == b->ob_sval[0]
-			&& memcmp(a->ob_sval, b->ob_sval, a->ob_size) == 0)) {
+			&& memcmp(a->ob_sval, b->ob_sval, Py_Size(a)) == 0)) {
 			result = Py_True;
 		} else {
 			result = Py_False;
 		}
 		goto out;
 	}
-	len_a = a->ob_size; len_b = b->ob_size;
+	len_a = Py_Size(a); len_b = Py_Size(b);
 	min_len = (len_a < len_b) ? len_a : len_b;
 	if (min_len > 0) {
 		c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval);
@@ -1159,9 +1159,9 @@
 {
 	PyStringObject *a = (PyStringObject*) o1;
 	PyStringObject *b = (PyStringObject*) o2;
-        return a->ob_size == b->ob_size
+        return Py_Size(a) == Py_Size(b)
           && *a->ob_sval == *b->ob_sval
-          && memcmp(a->ob_sval, b->ob_sval, a->ob_size) == 0;
+          && memcmp(a->ob_sval, b->ob_sval, Py_Size(a)) == 0;
 }
 
 static long
@@ -1173,12 +1173,12 @@
 
 	if (a->ob_shash != -1)
 		return a->ob_shash;
-	len = a->ob_size;
+	len = Py_Size(a);
 	p = (unsigned char *) a->ob_sval;
 	x = *p << 7;
 	while (--len >= 0)
 		x = (1000003*x) ^ *p++;
-	x ^= a->ob_size;
+	x ^= Py_Size(a);
 	if (x == -1)
 		x = -2;
 	a->ob_shash = x;
@@ -1231,7 +1231,7 @@
 	else {
 		PyErr_Format(PyExc_TypeError,
 			     "string indices must be integers, not %.200s",
-			     item->ob_type->tp_name);
+			     Py_Type(item)->tp_name);
 		return NULL;
 	}
 }
@@ -1245,7 +1245,7 @@
 		return -1;
 	}
 	*ptr = (void *)self->ob_sval;
-	return self->ob_size;
+	return Py_Size(self);
 }
 
 static Py_ssize_t
@@ -1260,7 +1260,7 @@
 string_buffer_getsegcount(PyStringObject *self, Py_ssize_t *lenp)
 {
 	if ( lenp )
-		*lenp = self->ob_size;
+		*lenp = Py_Size(self);
 	return 1;
 }
 
@@ -1273,7 +1273,7 @@
 		return -1;
 	}
 	*ptr = self->ob_sval;
-	return self->ob_size;
+	return Py_Size(self);
 }
 
 static PySequenceMethods string_as_sequence = {
@@ -1362,7 +1362,7 @@
 	count++; }
 
 /* Always force the list to the expected size. */
-#define FIX_PREALLOC_SIZE(list) ((PyListObject *)list)->ob_size = count
+#define FIX_PREALLOC_SIZE(list) Py_Size(list) = count
 
 #define SKIP_SPACE(s, i, len)    { while (i<len &&  isspace(Py_CHARMASK(s[i]))) i++; }
 #define SKIP_NONSPACE(s, i, len) { while (i<len && !isspace(Py_CHARMASK(s[i]))) i++; }
@@ -1767,7 +1767,7 @@
 			PyErr_Format(PyExc_TypeError,
 				     "sequence item %zd: expected string,"
 				     " %.80s found",
-				     i, item->ob_type->tp_name);
+				     i, Py_Type(item)->tp_name);
 			Py_DECREF(seq);
 			return NULL;
 		}
@@ -3207,7 +3207,7 @@
         PyErr_Format(PyExc_TypeError,
                      "[str8] encoder did not return a bytes object "
                      "(type=%.400s)",
-                     v->ob_type->tp_name);
+                     Py_Type(v)->tp_name);
         Py_DECREF(v);
         return NULL;
     }
@@ -3244,7 +3244,7 @@
         PyErr_Format(PyExc_TypeError,
                      "decoder did not return a string/unicode object "
                      "(type=%.400s)",
-                     v->ob_type->tp_name);
+                     Py_Type(v)->tp_name);
         Py_DECREF(v);
         return NULL;
     }
@@ -3802,7 +3802,7 @@
 static PyObject *
 string_getnewargs(PyStringObject *v)
 {
-	return Py_BuildValue("(s#)", v->ob_sval, v->ob_size);
+	return Py_BuildValue("(s#)", v->ob_sval, Py_Size(v));
 }
 
 
@@ -3928,8 +3928,7 @@
 
 
 PyTypeObject PyBaseString_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"basestring",
 	0,
 	0,
@@ -3979,8 +3978,7 @@
 static PyObject *str_iter(PyObject *seq);
 
 PyTypeObject PyString_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"str8",
 	sizeof(PyStringObject),
 	sizeof(char),
@@ -4066,7 +4064,7 @@
 	register PyObject *v;
 	register PyStringObject *sv;
 	v = *pv;
-	if (!PyString_Check(v) || v->ob_refcnt != 1 || newsize < 0 ||
+	if (!PyString_Check(v) || Py_Refcnt(v) != 1 || newsize < 0 ||
 	    PyString_CHECK_INTERNED(v)) {
 		*pv = 0;
 		Py_DECREF(v);
@@ -4085,7 +4083,7 @@
 	}
 	_Py_NewReference(*pv);
 	sv = (PyStringObject *) *pv;
-	sv->ob_size = newsize;
+	Py_Size(sv) = newsize;
 	sv->ob_sval[newsize] = '\0';
 	sv->ob_shash = -1;	/* invalidate cached hash value */
 	return 0;
@@ -4133,7 +4131,7 @@
 	x = PyFloat_AsDouble(v);
 	if (x == -1.0 && PyErr_Occurred()) {
 		PyErr_Format(PyExc_TypeError, "float argument required, "
-			     "not %.200s", v->ob_type->tp_name);
+			     "not %.200s", Py_Type(v)->tp_name);
 		return -1;
 	}
 	if (prec < 0)
@@ -4215,7 +4213,7 @@
 	switch (type) {
 	case 'd':
 	case 'u':
-		result = val->ob_type->tp_str(val);
+		result = Py_Type(val)->tp_str(val);
 		break;
 	case 'o':
 		numnondigits = 2;
@@ -4239,7 +4237,7 @@
 	}
 
 	/* To modify the string in-place, there can only be one reference. */
-	if (result->ob_refcnt != 1) {
+	if (Py_Refcnt(result) != 1) {
 		PyErr_BadInternalCall();
 		return NULL;
 	}
@@ -4323,7 +4321,7 @@
 	x = PyInt_AsLong(v);
 	if (x == -1 && PyErr_Occurred()) {
 		PyErr_Format(PyExc_TypeError, "int argument required, not %.200s",
-			     v->ob_type->tp_name);
+			     Py_Type(v)->tp_name);
 		return -1;
 	}
 	if (x < 0 && type == 'u') {
@@ -4439,7 +4437,7 @@
 		arglen = -1;
 		argidx = -2;
 	}
-	if (args->ob_type->tp_as_mapping && !PyTuple_Check(args) &&
+	if (Py_Type(args)->tp_as_mapping && !PyTuple_Check(args) &&
 	    !PyObject_TypeCheck(args, &PyBaseString_Type))
 		dict = args;
 	while (--fmtcnt >= 0) {
@@ -4901,7 +4899,7 @@
 	}
 	/* The two references in interned are not counted by refcnt.
 	   The string deallocator will take care of this */
-	s->ob_refcnt -= 2;
+	Py_Refcnt(s) -= 2;
 	PyString_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL;
 }
 
@@ -4968,12 +4966,12 @@
 			/* XXX Shouldn't happen */
 			break;
 		case SSTATE_INTERNED_IMMORTAL:
-			s->ob_refcnt += 1;
-			immortal_size += s->ob_size;
+			Py_Refcnt(s) += 1;
+			immortal_size += Py_Size(s);
 			break;
 		case SSTATE_INTERNED_MORTAL:
-			s->ob_refcnt += 2;
-			mortal_size += s->ob_size;
+			Py_Refcnt(s) += 2;
+			mortal_size += Py_Size(s);
 			break;
 		default:
 			Py_FatalError("Inconsistent interned string state.");
@@ -5057,8 +5055,7 @@
 };
 
 PyTypeObject PyStringIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"striterator",				/* tp_name */
 	sizeof(striterobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/structseq.c
==============================================================================
--- python/branches/py3k-struni/Objects/structseq.c	(original)
+++ python/branches/py3k-struni/Objects/structseq.c	Sat Jul 21 19:22:18 2007
@@ -13,17 +13,17 @@
    They are only allowed for indices < n_visible_fields. */
 char *PyStructSequence_UnnamedField = "unnamed field";
 
-#define VISIBLE_SIZE(op) ((op)->ob_size)
+#define VISIBLE_SIZE(op) Py_Size(op)
 #define VISIBLE_SIZE_TP(tp) PyInt_AsLong( \
                       PyDict_GetItemString((tp)->tp_dict, visible_length_key))
 
 #define REAL_SIZE_TP(tp) PyInt_AsLong( \
                       PyDict_GetItemString((tp)->tp_dict, real_length_key))
-#define REAL_SIZE(op) REAL_SIZE_TP((op)->ob_type)
+#define REAL_SIZE(op) REAL_SIZE_TP(Py_Type(op))
 
 #define UNNAMED_FIELDS_TP(tp) PyInt_AsLong( \
                       PyDict_GetItemString((tp)->tp_dict, unnamed_fields_key))
-#define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP((op)->ob_type)
+#define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_Type(op))
 
 
 PyObject *
@@ -32,7 +32,7 @@
 	PyStructSequence *obj;
        
 	obj = PyObject_New(PyStructSequence, type);
-	obj->ob_size = VISIBLE_SIZE_TP(type);
+	Py_Size(obj) = VISIBLE_SIZE_TP(type);
 
 	return (PyObject*) obj;
 }
@@ -274,12 +274,12 @@
 	}
 	
 	for (; i < n_fields; i++) {
-		char *n = self->ob_type->tp_members[i-n_unnamed_fields].name;
+		char *n = Py_Type(self)->tp_members[i-n_unnamed_fields].name;
 		PyDict_SetItemString(dict, n,
 				     self->ob_item[i]);
 	}
 
-	result = Py_BuildValue("(O(OO))", self->ob_type, tup, dict);
+	result = Py_BuildValue("(O(OO))", Py_Type(self), tup, dict);
 
 	Py_DECREF(tup);
 	Py_DECREF(dict);
@@ -305,8 +305,7 @@
 };
 
 static PyTypeObject _struct_sequence_template = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	NULL,	                     		/* tp_name */
         0,		                        /* tp_basicsize */
 	0,	                      		/* tp_itemsize */
@@ -356,7 +355,7 @@
 #ifdef Py_TRACE_REFS
 	/* if the type object was chained, unchain it first
 	   before overwriting its storage */
-	if (type->_ob_next) {
+	if (type->ob_base.ob_base._ob_next) {
 		_Py_ForgetReference((PyObject*)type);
 	}
 #endif

Modified: python/branches/py3k-struni/Objects/tupleobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/tupleobject.c	(original)
+++ python/branches/py3k-struni/Objects/tupleobject.c	Sat Jul 21 19:22:18 2007
@@ -49,8 +49,8 @@
 #endif
 		/* Inline PyObject_InitVar */
 #ifdef Py_TRACE_REFS
-		op->ob_size = size;
-		op->ob_type = &PyTuple_Type;
+		Py_Size(op) = size;
+		Py_Type(op) = &PyTuple_Type;
 #endif
 		_Py_NewReference((PyObject *)op);
 	}
@@ -90,7 +90,7 @@
 		return -1;
 	}
 	else
-		return ((PyTupleObject *)op)->ob_size;
+		return Py_Size(op);
 }
 
 PyObject *
@@ -100,7 +100,7 @@
 		PyErr_BadInternalCall();
 		return NULL;
 	}
-	if (i < 0 || i >= ((PyTupleObject *)op) -> ob_size) {
+	if (i < 0 || i >= Py_Size(op)) {
 		PyErr_SetString(PyExc_IndexError, "tuple index out of range");
 		return NULL;
 	}
@@ -117,7 +117,7 @@
 		PyErr_BadInternalCall();
 		return -1;
 	}
-	if (i < 0 || i >= ((PyTupleObject *)op) -> ob_size) {
+	if (i < 0 || i >= Py_Size(op)) {
 		Py_XDECREF(newitem);
 		PyErr_SetString(PyExc_IndexError,
 				"tuple assignment index out of range");
@@ -160,7 +160,7 @@
 tupledealloc(register PyTupleObject *op)
 {
 	register Py_ssize_t i;
-	register Py_ssize_t len =  op->ob_size;
+	register Py_ssize_t len =  Py_Size(op);
 	PyObject_GC_UnTrack(op);
 	Py_TRASHCAN_SAFE_BEGIN(op)
 	if (len > 0) {
@@ -170,7 +170,7 @@
 #if MAXSAVESIZE > 0
 		if (len < MAXSAVESIZE &&
 		    num_free_tuples[len] < MAXSAVEDTUPLES &&
-		    op->ob_type == &PyTuple_Type)
+		    Py_Type(op) == &PyTuple_Type)
 		{
 			op->ob_item[0] = (PyObject *) free_tuples[len];
 			num_free_tuples[len]++;
@@ -179,7 +179,7 @@
 		}
 #endif
 	}
-	op->ob_type->tp_free((PyObject *)op);
+	Py_Type(op)->tp_free((PyObject *)op);
 done:
 	Py_TRASHCAN_SAFE_END(op)
 }
@@ -189,13 +189,13 @@
 {
 	Py_ssize_t i;
 	fprintf(fp, "(");
-	for (i = 0; i < op->ob_size; i++) {
+	for (i = 0; i < Py_Size(op); i++) {
 		if (i > 0)
 			fprintf(fp, ", ");
 		if (PyObject_Print(op->ob_item[i], fp, 0) != 0)
 			return -1;
 	}
-	if (op->ob_size == 1)
+	if (Py_Size(op) == 1)
 		fprintf(fp, ",");
 	fprintf(fp, ")");
 	return 0;
@@ -208,7 +208,7 @@
 	PyObject *s, *temp;
 	PyObject *pieces, *result = NULL;
 
-	n = v->ob_size;
+	n = Py_Size(v);
 	if (n == 0)
 		return PyUnicode_FromString("()");
 
@@ -268,7 +268,7 @@
 tuplehash(PyTupleObject *v)
 {
 	register long x, y;
-	register Py_ssize_t len = v->ob_size;
+	register Py_ssize_t len = Py_Size(v);
 	register PyObject **p;
 	long mult = 1000003L;
 	x = 0x345678L;
@@ -290,7 +290,7 @@
 static Py_ssize_t
 tuplelength(PyTupleObject *a)
 {
-	return a->ob_size;
+	return Py_Size(a);
 }
 
 static int
@@ -299,7 +299,7 @@
 	Py_ssize_t i;
 	int cmp;
 
-	for (i = 0, cmp = 0 ; cmp == 0 && i < a->ob_size; ++i)
+	for (i = 0, cmp = 0 ; cmp == 0 && i < Py_Size(a); ++i)
 		cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i),
 						   Py_EQ);
 	return cmp;
@@ -308,7 +308,7 @@
 static PyObject *
 tupleitem(register PyTupleObject *a, register Py_ssize_t i)
 {
-	if (i < 0 || i >= a->ob_size) {
+	if (i < 0 || i >= Py_Size(a)) {
 		PyErr_SetString(PyExc_IndexError, "tuple index out of range");
 		return NULL;
 	}
@@ -326,11 +326,11 @@
 	Py_ssize_t len;
 	if (ilow < 0)
 		ilow = 0;
-	if (ihigh > a->ob_size)
-		ihigh = a->ob_size;
+	if (ihigh > Py_Size(a))
+		ihigh = Py_Size(a);
 	if (ihigh < ilow)
 		ihigh = ilow;
-	if (ilow == 0 && ihigh == a->ob_size && PyTuple_CheckExact(a)) {
+	if (ilow == 0 && ihigh == Py_Size(a) && PyTuple_CheckExact(a)) {
 		Py_INCREF(a);
 		return (PyObject *)a;
 	}
@@ -368,11 +368,11 @@
 	if (!PyTuple_Check(bb)) {
 		PyErr_Format(PyExc_TypeError,
        		     "can only concatenate tuple (not \"%.200s\") to tuple",
-			     bb->ob_type->tp_name);
+			     Py_Type(bb)->tp_name);
 		return NULL;
 	}
 #define b ((PyTupleObject *)bb)
-	size = a->ob_size + b->ob_size;
+	size = Py_Size(a) + Py_Size(b);
 	if (size < 0)
 		return PyErr_NoMemory();
 	np = (PyTupleObject *) PyTuple_New(size);
@@ -381,14 +381,14 @@
 	}
 	src = a->ob_item;
 	dest = np->ob_item;
-	for (i = 0; i < a->ob_size; i++) {
+	for (i = 0; i < Py_Size(a); i++) {
 		PyObject *v = src[i];
 		Py_INCREF(v);
 		dest[i] = v;
 	}
 	src = b->ob_item;
-	dest = np->ob_item + a->ob_size;
-	for (i = 0; i < b->ob_size; i++) {
+	dest = np->ob_item + Py_Size(a);
+	for (i = 0; i < Py_Size(b); i++) {
 		PyObject *v = src[i];
 		Py_INCREF(v);
 		dest[i] = v;
@@ -406,18 +406,18 @@
 	PyObject **p, **items;
 	if (n < 0)
 		n = 0;
-	if (a->ob_size == 0 || n == 1) {
+	if (Py_Size(a) == 0 || n == 1) {
 		if (PyTuple_CheckExact(a)) {
 			/* Since tuples are immutable, we can return a shared
 			   copy in this case */
 			Py_INCREF(a);
 			return (PyObject *)a;
 		}
-		if (a->ob_size == 0)
+		if (Py_Size(a) == 0)
 			return PyTuple_New(0);
 	}
-	size = a->ob_size * n;
-	if (size/a->ob_size != n)
+	size = Py_Size(a) * n;
+	if (size/Py_Size(a) != n)
 		return PyErr_NoMemory();
 	np = (PyTupleObject *) PyTuple_New(size);
 	if (np == NULL)
@@ -425,7 +425,7 @@
 	p = np->ob_item;
 	items = a->ob_item;
 	for (i = 0; i < n; i++) {
-		for (j = 0; j < a->ob_size; j++) {
+		for (j = 0; j < Py_Size(a); j++) {
 			*p = items[j];
 			Py_INCREF(*p);
 			p++;
@@ -439,7 +439,7 @@
 {
 	Py_ssize_t i;
 
-	for (i = o->ob_size; --i >= 0; )
+	for (i = Py_Size(o); --i >= 0; )
 		Py_VISIT(o->ob_item[i]);
 	return 0;
 }
@@ -459,8 +459,8 @@
 	vt = (PyTupleObject *)v;
 	wt = (PyTupleObject *)w;
 
-	vlen = vt->ob_size;
-	wlen = wt->ob_size;
+	vlen = Py_Size(vt);
+	wlen = Py_Size(wt);
 
 	/* Note:  the corresponding code for lists has an "early out" test
 	 * here when op is EQ or NE and the lengths differ.  That pays there,
@@ -622,7 +622,7 @@
 	else {
 		PyErr_Format(PyExc_TypeError, 
 			     "tuple indices must be integers, not %.200s",
-			     item->ob_type->tp_name);
+			     Py_Type(item)->tp_name);
 		return NULL;
 	}
 }
@@ -630,7 +630,7 @@
 static PyObject *
 tuple_getnewargs(PyTupleObject *v)
 {
-	return Py_BuildValue("(N)", tupleslice(v, 0, v->ob_size));
+	return Py_BuildValue("(N)", tupleslice(v, 0, Py_Size(v)));
 	
 }
 
@@ -648,8 +648,7 @@
 static PyObject *tuple_iter(PyObject *seq);
 
 PyTypeObject PyTuple_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"tuple",
 	sizeof(PyTupleObject) - sizeof(PyObject *),
 	sizeof(PyObject *),
@@ -707,14 +706,14 @@
 	Py_ssize_t oldsize;
 
 	v = (PyTupleObject *) *pv;
-	if (v == NULL || v->ob_type != &PyTuple_Type ||
-	    (v->ob_size != 0 && v->ob_refcnt != 1)) {
+	if (v == NULL || Py_Type(v) != &PyTuple_Type ||
+	    (Py_Size(v) != 0 && Py_Refcnt(v) != 1)) {
 		*pv = 0;
 		Py_XDECREF(v);
 		PyErr_BadInternalCall();
 		return -1;
 	}
-	oldsize = v->ob_size;
+	oldsize = Py_Size(v);
 	if (oldsize == newsize)
 		return 0;
 
@@ -838,8 +837,7 @@
 };
 
 PyTypeObject PyTupleIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"tupleiterator",			/* tp_name */
 	sizeof(tupleiterobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/typeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/typeobject.c	(original)
+++ python/branches/py3k-struni/Objects/typeobject.c	Sat Jul 21 19:22:18 2007
@@ -63,7 +63,7 @@
 	if (!PyString_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 			     "can only assign string to %s.__name__, not '%s'",
-			     type->tp_name, value->ob_type->tp_name);
+			     type->tp_name, Py_Type(value)->tp_name);
 		return -1;
 	}
 	if (strlen(PyString_AS_STRING(value))
@@ -209,7 +209,7 @@
 	if (!PyTuple_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 		     "can only assign tuple to %s.__bases__, not %s",
-			     type->tp_name, value->ob_type->tp_name);
+			     type->tp_name, Py_Type(value)->tp_name);
 		return -1;
 	}
 	if (PyTuple_GET_SIZE(value) == 0) {
@@ -224,7 +224,7 @@
 			PyErr_Format(
 				PyExc_TypeError,
 	"%s.__bases__ must be tuple of old- or new-style classes, not '%s'",
-				type->tp_name, ob->ob_type->tp_name);
+				type->tp_name, Py_Type(ob)->tp_name);
 			return -1;
 		}
 		if (PyType_Check(ob)) {
@@ -349,8 +349,8 @@
 		result = Py_None;
 		Py_INCREF(result);
 	}
-	else if (result->ob_type->tp_descr_get) {
-		result = result->ob_type->tp_descr_get(result, NULL,
+	else if (Py_Type(result)->tp_descr_get) {
+		result = Py_Type(result)->tp_descr_get(result, NULL,
 						       (PyObject *)type);
 	}
 	else {
@@ -423,9 +423,9 @@
 			return obj;
 		/* If the returned object is not an instance of type,
 		   it won't be initialized. */
-		if (!PyType_IsSubtype(obj->ob_type, type))
+		if (!PyType_IsSubtype(Py_Type(obj), type))
 			return obj;
-		type = obj->ob_type;
+		type = Py_Type(obj);
 		if (type->tp_init != NULL &&
 		    type->tp_init(obj, args, kwds) < 0) {
 			Py_DECREF(obj);
@@ -479,7 +479,7 @@
 	Py_ssize_t i, n;
 	PyMemberDef *mp;
 
-	n = type->ob_size;
+	n = Py_Size(type);
 	mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
 	for (i = 0; i < n; i++, mp++) {
 		if (mp->type == T_OBJECT_EX) {
@@ -503,10 +503,10 @@
 
 	/* Find the nearest base with a different tp_traverse,
 	   and traverse slots while we're at it */
-	type = self->ob_type;
+	type = Py_Type(self);
 	base = type;
 	while ((basetraverse = base->tp_traverse) == subtype_traverse) {
-		if (base->ob_size) {
+		if (Py_Size(base)) {
 			int err = traverse_slots(base, self, visit, arg);
 			if (err)
 				return err;
@@ -538,7 +538,7 @@
 	Py_ssize_t i, n;
 	PyMemberDef *mp;
 
-	n = type->ob_size;
+	n = Py_Size(type);
 	mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
 	for (i = 0; i < n; i++, mp++) {
 		if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) {
@@ -560,10 +560,10 @@
 
 	/* Find the nearest base with a different tp_clear
 	   and clear slots while we're at it */
-	type = self->ob_type;
+	type = Py_Type(self);
 	base = type;
 	while ((baseclear = base->tp_clear) == subtype_clear) {
-		if (base->ob_size)
+		if (Py_Size(base))
 			clear_slots(base, self);
 		base = base->tp_base;
 		assert(base);
@@ -584,7 +584,7 @@
 	destructor basedealloc;
 
 	/* Extract the type; we expect it to be a heap type */
-	type = self->ob_type;
+	type = Py_Type(self);
 	assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE);
 
 	/* Test whether the type has GC exactly once */
@@ -606,7 +606,7 @@
 		/* Find the nearest base with a different tp_dealloc */
 		base = type;
 		while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
-			assert(base->ob_size == 0);
+			assert(Py_Size(base) == 0);
 			base = base->tp_base;
 			assert(base);
 		}
@@ -674,7 +674,7 @@
 	/*  Clear slots up to the nearest base with a different tp_dealloc */
 	base = type;
 	while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
-		if (base->ob_size)
+		if (Py_Size(base))
 			clear_slots(base, self);
 		base = base->tp_base;
 		assert(base);
@@ -865,13 +865,13 @@
 		if (*attrobj == NULL)
 			return NULL;
 	}
-	res = _PyType_Lookup(self->ob_type, *attrobj);
+	res = _PyType_Lookup(Py_Type(self), *attrobj);
 	if (res != NULL) {
 		descrgetfunc f;
-		if ((f = res->ob_type->tp_descr_get) == NULL)
+		if ((f = Py_Type(res)->tp_descr_get) == NULL)
 			Py_INCREF(res);
 		else
-			res = f(res, self, (PyObject *)(self->ob_type));
+			res = f(res, self, (PyObject *)(Py_Type(self)));
 	}
 	return res;
 }
@@ -1244,7 +1244,7 @@
 	PyObject *mro, *result, *tuple;
 	int checkit = 0;
 
-	if (type->ob_type == &PyType_Type) {
+	if (Py_Type(type) == &PyType_Type) {
 		result = mro_implementation(type);
 	}
 	else {
@@ -1277,7 +1277,7 @@
 			if (!PyType_Check(cls)) {
 				PyErr_Format(PyExc_TypeError,
 			     "mro() returned a non-class ('%.500s')",
-					     cls->ob_type->tp_name);
+					     Py_Type(cls)->tp_name);
 				Py_DECREF(tuple);
 				return -1;
 			}
@@ -1433,7 +1433,7 @@
 {
 	PyErr_Format(PyExc_TypeError,
 		     "this __dict__ descriptor does not support "
-		     "'%.200s' objects", obj->ob_type->tp_name);
+		     "'%.200s' objects", Py_Type(obj)->tp_name);
 }
 
 static PyObject *
@@ -1443,7 +1443,7 @@
 	PyObject *dict;
 	PyTypeObject *base;
 
-	base = get_builtin_base_with_dict(obj->ob_type);
+	base = get_builtin_base_with_dict(Py_Type(obj));
 	if (base != NULL) {
 		descrgetfunc func;
 		PyObject *descr = get_dict_descriptor(base);
@@ -1451,12 +1451,12 @@
 			raise_dict_descr_error(obj);
 			return NULL;
 		}
-		func = descr->ob_type->tp_descr_get;
+		func = Py_Type(descr)->tp_descr_get;
 		if (func == NULL) {
 			raise_dict_descr_error(obj);
 			return NULL;
 		}
-		return func(descr, obj, (PyObject *)(obj->ob_type));
+		return func(descr, obj, (PyObject *)(Py_Type(obj)));
 	}
 
 	dictptr = _PyObject_GetDictPtr(obj);
@@ -1479,7 +1479,7 @@
 	PyObject *dict;
 	PyTypeObject *base;
 
-	base = get_builtin_base_with_dict(obj->ob_type);
+	base = get_builtin_base_with_dict(Py_Type(obj));
 	if (base != NULL) {
 		descrsetfunc func;
 		PyObject *descr = get_dict_descriptor(base);
@@ -1487,7 +1487,7 @@
 			raise_dict_descr_error(obj);
 			return -1;
 		}
-		func = descr->ob_type->tp_descr_set;
+		func = Py_Type(descr)->tp_descr_set;
 		if (func == NULL) {
 			raise_dict_descr_error(obj);
 			return -1;
@@ -1504,7 +1504,7 @@
 	if (value != NULL && !PyDict_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 			     "__dict__ must be set to a dictionary, "
-			     "not a '%.200s'", value->ob_type->tp_name);
+			     "not a '%.200s'", Py_Type(value)->tp_name);
 		return -1;
 	}
 	dict = *dictptr;
@@ -1520,16 +1520,16 @@
 	PyObject **weaklistptr;
 	PyObject *result;
 
-	if (obj->ob_type->tp_weaklistoffset == 0) {
+	if (Py_Type(obj)->tp_weaklistoffset == 0) {
 		PyErr_SetString(PyExc_AttributeError,
 				"This object has no __weakref__");
 		return NULL;
 	}
-	assert(obj->ob_type->tp_weaklistoffset > 0);
-	assert(obj->ob_type->tp_weaklistoffset + sizeof(PyObject *) <=
-	       (size_t)(obj->ob_type->tp_basicsize));
+	assert(Py_Type(obj)->tp_weaklistoffset > 0);
+	assert(Py_Type(obj)->tp_weaklistoffset + sizeof(PyObject *) <=
+	       (size_t)(Py_Type(obj)->tp_basicsize));
 	weaklistptr = (PyObject **)
-		((char *)obj + obj->ob_type->tp_weaklistoffset);
+		((char *)obj + Py_Type(obj)->tp_weaklistoffset);
 	if (*weaklistptr == NULL)
 		result = Py_None;
 	else
@@ -1569,7 +1569,7 @@
 	if (!PyUnicode_Check(s)) {
 		PyErr_Format(PyExc_TypeError,
 			     "__slots__ items must be strings, not '%.200s'",
-			     s->ob_type->tp_name);
+			     Py_Type(s)->tp_name);
 		return 0;
 	}
 	p = PyUnicode_AS_UNICODE(s);
@@ -1643,8 +1643,8 @@
 
 		if (PyType_CheckExact(metatype) && nargs == 1 && nkwds == 0) {
 			PyObject *x = PyTuple_GET_ITEM(args, 0);
-			Py_INCREF(x->ob_type);
-			return (PyObject *) x->ob_type;
+			Py_INCREF(Py_Type(x));
+			return (PyObject *) Py_Type(x);
 		}
 
 		/* SF bug 475327 -- if that didn't trigger, we need 3
@@ -1672,7 +1672,7 @@
 	winner = metatype;
 	for (i = 0; i < nbases; i++) {
 		tmp = PyTuple_GET_ITEM(bases, i);
-		tmptype = tmp->ob_type;
+		tmptype = Py_Type(tmp);
 		if (PyType_IsSubtype(winner, tmptype))
 			continue;
 		if (PyType_IsSubtype(tmptype, winner)) {
@@ -2056,7 +2056,7 @@
 static PyObject *
 type_getattro(PyTypeObject *type, PyObject *name)
 {
-	PyTypeObject *metatype = type->ob_type;
+	PyTypeObject *metatype = Py_Type(type);
 	PyObject *meta_attribute, *attribute;
 	descrgetfunc meta_get;
 
@@ -2073,7 +2073,7 @@
 	meta_attribute = _PyType_Lookup(metatype, name);
 
 	if (meta_attribute != NULL) {
-		meta_get = meta_attribute->ob_type->tp_descr_get;
+		meta_get = Py_Type(meta_attribute)->tp_descr_get;
 
 		if (meta_get != NULL && PyDescr_IsData(meta_attribute)) {
 			/* Data descriptors implement tp_descr_set to intercept
@@ -2091,7 +2091,7 @@
 	attribute = _PyType_Lookup(type, name);
 	if (attribute != NULL) {
 		/* Implement descriptor functionality, if any */
-		descrgetfunc local_get = attribute->ob_type->tp_descr_get;
+		descrgetfunc local_get = Py_Type(attribute)->tp_descr_get;
 
 		Py_XDECREF(meta_attribute);
 
@@ -2169,7 +2169,7 @@
 	PyObject_Free((char *)type->tp_doc);
 	Py_XDECREF(et->ht_name);
 	Py_XDECREF(et->ht_slots);
-	type->ob_type->tp_free((PyObject *)type);
+	Py_Type(type)->tp_free((PyObject *)type);
 }
 
 static PyObject *
@@ -2277,8 +2277,7 @@
 }
 
 PyTypeObject PyType_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"type",					/* tp_name */
 	sizeof(PyHeapTypeObject),		/* tp_basicsize */
 	sizeof(PyMemberDef),			/* tp_itemsize */
@@ -2380,7 +2379,7 @@
 {
 	int err = 0;
 	if (excess_args(args, kwds)) {
-		PyTypeObject *type = self->ob_type;
+		PyTypeObject *type = Py_Type(self);
 		if (type->tp_init != object_init &&
 		    type->tp_new != object_new)
 		{
@@ -2427,7 +2426,7 @@
 static void
 object_dealloc(PyObject *self)
 {
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static PyObject *
@@ -2436,7 +2435,7 @@
 	PyTypeObject *type;
 	PyObject *mod, *name, *rtn;
 
-	type = self->ob_type;
+	type = Py_Type(self);
 	mod = type_module(type, NULL);
 	if (mod == NULL)
 		PyErr_Clear();
@@ -2462,7 +2461,7 @@
 {
 	unaryfunc f;
 
-	f = self->ob_type->tp_repr;
+	f = Py_Type(self)->tp_repr;
 	if (f == NULL)
 		f = object_repr;
 	return f(self);
@@ -2511,8 +2510,8 @@
 static PyObject *
 object_get_class(PyObject *self, void *closure)
 {
-	Py_INCREF(self->ob_type);
-	return (PyObject *)(self->ob_type);
+	Py_INCREF(Py_Type(self));
+	return (PyObject *)(Py_Type(self));
 }
 
 static int
@@ -2597,7 +2596,7 @@
 static int
 object_set_class(PyObject *self, PyObject *value, void *closure)
 {
-	PyTypeObject *oldto = self->ob_type;
+	PyTypeObject *oldto = Py_Type(self);
 	PyTypeObject *newto;
 
 	if (value == NULL) {
@@ -2608,7 +2607,7 @@
 	if (!PyType_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 		  "__class__ must be set to new-style class, not '%s' object",
-		  value->ob_type->tp_name);
+		  Py_Type(value)->tp_name);
 		return -1;
 	}
 	newto = (PyTypeObject *)value;
@@ -2621,7 +2620,7 @@
 	}
 	if (compatible_for_assignment(newto, oldto, "__class__")) {
 		Py_INCREF(newto);
-		self->ob_type = newto;
+		Py_Type(self) = newto;
 		Py_DECREF(oldto);
 		return 0;
 	}
@@ -2717,7 +2716,7 @@
 		if (args != NULL && !PyTuple_Check(args)) {
 			PyErr_Format(PyExc_TypeError,
 				"__getnewargs__ should return a tuple, "
-				"not '%.200s'", args->ob_type->tp_name);
+				"not '%.200s'", Py_Type(args)->tp_name);
 			goto end;
 		}
 	}
@@ -2933,8 +2932,7 @@
 
 
 PyTypeObject PyBaseObject_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"object",				/* tp_name */
 	sizeof(PyObject),			/* tp_basicsize */
 	0,					/* tp_itemsize */
@@ -3360,8 +3358,8 @@
 	   NULL when type is &PyBaseObject_Type, and we know its ob_type is
 	   not NULL (it's initialized to &PyType_Type).	 But coverity doesn't
 	   know that. */
-	if (type->ob_type == NULL && base != NULL)
-		type->ob_type = base->ob_type;
+	if (Py_Type(type) == NULL && base != NULL)
+		Py_Type(type) = Py_Type(base);
 
 	/* Initialize tp_bases */
 	bases = type->tp_bases;
@@ -3630,7 +3628,7 @@
 	if (!check_num_args(args, 1))
 		return NULL;
 	other = PyTuple_GET_ITEM(args, 0);
-	if (!PyType_IsSubtype(other->ob_type, self->ob_type)) {
+	if (!PyType_IsSubtype(Py_Type(other), Py_Type(self))) {
 		Py_INCREF(Py_NotImplemented);
 		return Py_NotImplemented;
 	}
@@ -3699,7 +3697,7 @@
 	if (i == -1 && PyErr_Occurred())
 		return -1;
 	if (i < 0) {
-		PySequenceMethods *sq = self->ob_type->tp_as_sequence;
+		PySequenceMethods *sq = Py_Type(self)->tp_as_sequence;
 		if (sq && sq->sq_length) {
 			Py_ssize_t n = (*sq->sq_length)(self);
 			if (n < 0)
@@ -3875,14 +3873,14 @@
 	if (!check_num_args(args, 1))
 		return NULL;
 	other = PyTuple_GET_ITEM(args, 0);
-	if (other->ob_type->tp_compare != func &&
-	    !PyType_IsSubtype(other->ob_type, self->ob_type)) {
+	if (Py_Type(other)->tp_compare != func &&
+	    !PyType_IsSubtype(Py_Type(other), Py_Type(self))) {
 		PyErr_Format(
 			PyExc_TypeError,
 			"%s.__cmp__(x,y) requires y to be a '%s', not a '%s'",
-			self->ob_type->tp_name,
-			self->ob_type->tp_name,
-			other->ob_type->tp_name);
+			Py_Type(self)->tp_name,
+			Py_Type(self)->tp_name,
+			Py_Type(other)->tp_name);
 		return NULL;
 	}
 	res = (*func)(self, other);
@@ -3896,7 +3894,7 @@
 static int
 hackcheck(PyObject *self, setattrofunc func, char *what)
 {
-	PyTypeObject *type = self->ob_type;
+	PyTypeObject *type = Py_Type(self);
 	while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE)
 		type = type->tp_base;
 	/* If type is NULL now, this is a really weird type.
@@ -4096,7 +4094,7 @@
 		PyErr_Format(PyExc_TypeError,
 			     "%s.__new__(X): X is not a type object (%s)",
 			     type->tp_name,
-			     arg0->ob_type->tp_name);
+			     Py_Type(arg0)->tp_name);
 		return NULL;
 	}
 	subtype = (PyTypeObject *)arg0;
@@ -4187,14 +4185,14 @@
 	PyObject *a, *b;
 	int ok;
 
-	b = PyObject_GetAttrString((PyObject *)(right->ob_type), name);
+	b = PyObject_GetAttrString((PyObject *)(Py_Type(right)), name);
 	if (b == NULL) {
 		PyErr_Clear();
 		/* If right doesn't have it, it's not overloaded */
 		return 0;
 	}
 
-	a = PyObject_GetAttrString((PyObject *)(left->ob_type), name);
+	a = PyObject_GetAttrString((PyObject *)(Py_Type(left)), name);
 	if (a == NULL) {
 		PyErr_Clear();
 		Py_DECREF(b);
@@ -4219,14 +4217,14 @@
 FUNCNAME(PyObject *self, PyObject *other) \
 { \
 	static PyObject *cache_str, *rcache_str; \
-	int do_other = self->ob_type != other->ob_type && \
-	    other->ob_type->tp_as_number != NULL && \
-	    other->ob_type->tp_as_number->SLOTNAME == TESTFUNC; \
-	if (self->ob_type->tp_as_number != NULL && \
-	    self->ob_type->tp_as_number->SLOTNAME == TESTFUNC) { \
+	int do_other = Py_Type(self) != Py_Type(other) && \
+	    Py_Type(other)->tp_as_number != NULL && \
+	    Py_Type(other)->tp_as_number->SLOTNAME == TESTFUNC; \
+	if (Py_Type(self)->tp_as_number != NULL && \
+	    Py_Type(self)->tp_as_number->SLOTNAME == TESTFUNC) { \
 		PyObject *r; \
 		if (do_other && \
-		    PyType_IsSubtype(other->ob_type, self->ob_type) && \
+		    PyType_IsSubtype(Py_Type(other), Py_Type(self)) && \
 		    method_is_overloaded(self, other, ROPSTR)) { \
 			r = call_maybe( \
 				other, ROPSTR, &rcache_str, "(O)", self); \
@@ -4238,7 +4236,7 @@
 		r = call_maybe( \
 			self, OPSTR, &cache_str, "(O)", other); \
 		if (r != Py_NotImplemented || \
-		    other->ob_type == self->ob_type) \
+		    Py_Type(other) == Py_Type(self)) \
 			return r; \
 		Py_DECREF(r); \
 	} \
@@ -4296,12 +4294,12 @@
 		if (getitem_str == NULL)
 			return NULL;
 	}
-	func = _PyType_Lookup(self->ob_type, getitem_str);
+	func = _PyType_Lookup(Py_Type(self), getitem_str);
 	if (func != NULL) {
-		if ((f = func->ob_type->tp_descr_get) == NULL)
+		if ((f = Py_Type(func)->tp_descr_get) == NULL)
 			Py_INCREF(func);
 		else {
-			func = f(func, self, (PyObject *)(self->ob_type));
+			func = f(func, self, (PyObject *)(Py_Type(self)));
 			if (func == NULL) {
 				return NULL;
 			}
@@ -4439,8 +4437,8 @@
 	/* Three-arg power doesn't use __rpow__.  But ternary_op
 	   can call this when the second argument's type uses
 	   slot_nb_power, so check before calling self.__pow__. */
-	if (self->ob_type->tp_as_number != NULL &&
-	    self->ob_type->tp_as_number->nb_power == slot_nb_power) {
+	if (Py_Type(self)->tp_as_number != NULL &&
+	    Py_Type(self)->tp_as_number->nb_power == slot_nb_power) {
 		return call_method(self, "__pow__", &pow_str,
 				   "(OO)", other, modulus);
 	}
@@ -4485,7 +4483,7 @@
 				PyErr_Format(PyExc_TypeError,
 					 "__bool__ should return "
 					 "bool, returned %s",
-					 temp->ob_type->tp_name);
+					 Py_Type(temp)->tp_name);
 				result = -1;
 			}
 			Py_DECREF(temp);
@@ -4576,12 +4574,12 @@
 {
 	int c;
 
-	if (self->ob_type->tp_compare == _PyObject_SlotCompare) {
+	if (Py_Type(self)->tp_compare == _PyObject_SlotCompare) {
 		c = half_compare(self, other);
 		if (c <= 1)
 			return c;
 	}
-	if (other->ob_type->tp_compare == _PyObject_SlotCompare) {
+	if (Py_Type(other)->tp_compare == _PyObject_SlotCompare) {
 		c = half_compare(other, self);
 		if (c < -1)
 			return -2;
@@ -4606,7 +4604,7 @@
 	}
 	PyErr_Clear();
 	return PyUnicode_FromFormat("<%s object at %p>",
-				   self->ob_type->tp_name, self);
+				   Py_Type(self)->tp_name, self);
 }
 
 static PyObject *
@@ -4649,7 +4647,7 @@
 
 	if (func == NULL) {
 		PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'",
-			     self->ob_type->tp_name);
+			     Py_Type(self)->tp_name);
 		return -1;
         }
 
@@ -4714,7 +4712,7 @@
 static PyObject *
 slot_tp_getattr_hook(PyObject *self, PyObject *name)
 {
-	PyTypeObject *tp = self->ob_type;
+	PyTypeObject *tp = Py_Type(self);
 	PyObject *getattr, *getattribute, *res;
 	static PyObject *getattribute_str = NULL;
 	static PyObject *getattr_str = NULL;
@@ -4738,7 +4736,7 @@
 	}
 	getattribute = _PyType_Lookup(tp, getattribute_str);
 	if (getattribute == NULL ||
-	    (getattribute->ob_type == &PyWrapperDescr_Type &&
+	    (Py_Type(getattribute) == &PyWrapperDescr_Type &&
 	     ((PyWrapperDescrObject *)getattribute)->d_wrapped ==
 	     (void *)PyObject_GenericGetAttr))
 		res = PyObject_GenericGetAttr(self, name);
@@ -4797,13 +4795,13 @@
 {
 	PyObject *res;
 
-	if (self->ob_type->tp_richcompare == slot_tp_richcompare) {
+	if (Py_Type(self)->tp_richcompare == slot_tp_richcompare) {
 		res = half_richcompare(self, other, op);
 		if (res != Py_NotImplemented)
 			return res;
 		Py_DECREF(res);
 	}
-	if (other->ob_type->tp_richcompare == slot_tp_richcompare) {
+	if (Py_Type(other)->tp_richcompare == slot_tp_richcompare) {
 		res = half_richcompare(other, self, _Py_SwappedOp[op]);
 		if (res != Py_NotImplemented) {
 			return res;
@@ -4836,7 +4834,7 @@
 	if (func == NULL) {
 		PyErr_Format(PyExc_TypeError,
 			     "'%.200s' object is not iterable",
-			     self->ob_type->tp_name);
+			     Py_Type(self)->tp_name);
 		return NULL;
 	}
 	Py_DECREF(func);
@@ -4853,7 +4851,7 @@
 static PyObject *
 slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type)
 {
-	PyTypeObject *tp = self->ob_type;
+	PyTypeObject *tp = Py_Type(self);
 	PyObject *get;
 	static PyObject *get_str = NULL;
 
@@ -4911,7 +4909,7 @@
 	if (res != Py_None) {
 		PyErr_Format(PyExc_TypeError,
 			     "__init__() should return None, not '%.200s'",
-			     res->ob_type->tp_name);
+			     Py_Type(res)->tp_name);
 		Py_DECREF(res);
 		return -1;
 	}
@@ -4996,7 +4994,7 @@
 		_Py_NewReference(self);
 		self->ob_refcnt = refcnt;
 	}
-	assert(!PyType_IS_GC(self->ob_type) ||
+	assert(!PyType_IS_GC(Py_Type(self)) ||
 	       _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
 	/* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so
 	 * we need to undo that. */
@@ -5008,8 +5006,8 @@
 	 * undone.
 	 */
 #ifdef COUNT_ALLOCS
-	--self->ob_type->tp_frees;
-	--self->ob_type->tp_allocs;
+	--Py_Type(self)->tp_frees;
+	--Py_Type(self)->tp_allocs;
 #endif
 }
 
@@ -5359,7 +5357,7 @@
 		descr = _PyType_Lookup(type, p->name_strobj);
 		if (descr == NULL)
 			continue;
-		if (descr->ob_type == &PyWrapperDescr_Type) {
+		if (Py_Type(descr) == &PyWrapperDescr_Type) {
 			void **tptr = resolve_slotdups(type, p->name_strobj);
 			if (tptr == NULL || tptr == ptr)
 				generic = p->function;
@@ -5374,7 +5372,7 @@
 					use_generic = 1;
 			}
 		}
-		else if (descr->ob_type == &PyCFunction_Type &&
+		else if (Py_Type(descr) == &PyCFunction_Type &&
 			 PyCFunction_GET_FUNCTION(descr) ==
 			 (PyCFunction)tp_new_wrapper &&
 			 strcmp(p->name, "__new__") == 0)
@@ -5645,7 +5643,7 @@
 	Py_XDECREF(su->obj);
 	Py_XDECREF(su->type);
 	Py_XDECREF(su->obj_type);
-	self->ob_type->tp_free(self);
+	Py_Type(self)->tp_free(self);
 }
 
 static PyObject *
@@ -5708,7 +5706,7 @@
 			res = PyDict_GetItem(dict, name);
 			if (res != NULL) {
 				Py_INCREF(res);
-				f = res->ob_type->tp_descr_get;
+				f = Py_Type(res)->tp_descr_get;
 				if (f != NULL) {
 					tmp = f(res,
 						/* Only pass 'obj' param if
@@ -5744,7 +5742,7 @@
 	     the normal case; the return value is obj.__class__.
 
 	   But... when obj is an instance, we want to allow for the case where
-	   obj->ob_type is not a subclass of type, but obj.__class__ is!
+	   Py_Type(obj) is not a subclass of type, but obj.__class__ is!
 	   This will allow using super() with a proxy for obj.
 	*/
 
@@ -5755,9 +5753,9 @@
 	}
 
 	/* Normal case */
-	if (PyType_IsSubtype(obj->ob_type, type)) {
-		Py_INCREF(obj->ob_type);
-		return obj->ob_type;
+	if (PyType_IsSubtype(Py_Type(obj), type)) {
+		Py_INCREF(Py_Type(obj));
+		return Py_Type(obj);
 	}
 	else {
 		/* Try the slow way */
@@ -5774,7 +5772,7 @@
 
 		if (class_attr != NULL &&
 		    PyType_Check(class_attr) &&
-		    (PyTypeObject *)class_attr != obj->ob_type)
+		    (PyTypeObject *)class_attr != Py_Type(obj))
 		{
 			int ok = PyType_IsSubtype(
 				(PyTypeObject *)class_attr, type);
@@ -5805,10 +5803,10 @@
 		Py_INCREF(self);
 		return self;
 	}
-	if (su->ob_type != &PySuper_Type)
+	if (Py_Type(su) != &PySuper_Type)
 		/* If su is an instance of a (strict) subclass of super,
 		   call its type */
-		return PyObject_CallFunctionObjArgs((PyObject *)su->ob_type,
+		return PyObject_CallFunctionObjArgs((PyObject *)Py_Type(su),
 						    su->type, obj, NULL);
 	else {
 		/* Inline the common case */
@@ -5890,7 +5888,7 @@
 				if (!PyType_Check(type)) {
 				    PyErr_Format(PyExc_SystemError,
 				      "super(): __class__ is not a type (%s)",
-				      type->ob_type->tp_name);
+				      Py_Type(type)->tp_name);
 				    return -1;
 				}
 				break;
@@ -5946,8 +5944,7 @@
 }
 
 PyTypeObject PySuper_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"super",				/* tp_name */
 	sizeof(superobject),			/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/unicodeobject.c	(original)
+++ python/branches/py3k-struni/Objects/unicodeobject.c	Sat Jul 21 19:22:18 2007
@@ -338,7 +338,7 @@
     else {
 	PyMem_DEL(unicode->str);
 	Py_XDECREF(unicode->defenc);
-	unicode->ob_type->tp_free((PyObject *)unicode);
+	Py_Type(unicode)->tp_free((PyObject *)unicode);
     }
 }
 
@@ -352,7 +352,7 @@
 	return -1;
     }
     v = (PyUnicodeObject *)*unicode;
-    if (v == NULL || !PyUnicode_Check(v) || v->ob_refcnt != 1 || length < 0) {
+    if (v == NULL || !PyUnicode_Check(v) || Py_Refcnt(v) != 1 || length < 0) {
 	PyErr_BadInternalCall();
 	return -1;
     }
@@ -1004,7 +1004,7 @@
 	PyErr_Format(PyExc_TypeError,
 			 "coercing to Unicode: need string or buffer, "
 			 "%.80s found",
-		     obj->ob_type->tp_name);
+		     Py_Type(obj)->tp_name);
 	goto onError;
     }
 
@@ -1054,7 +1054,7 @@
     if (!PyUnicode_Check(unicode)) {
         PyErr_Format(PyExc_TypeError,
                      "decoder did not return an unicode object (type=%.400s)",
-                     unicode->ob_type->tp_name);
+                     Py_Type(unicode)->tp_name);
         Py_DECREF(unicode);
         goto onError;
     }
@@ -3722,8 +3722,7 @@
 }
 
 static PyTypeObject EncodingMapType = {
-	PyObject_HEAD_INIT(NULL)
-        0,                      /*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
         "EncodingMap",          /*tp_name*/
         sizeof(struct encoding_map),   /*tp_basicsize*/
         0,                      /*tp_itemsize*/
@@ -3984,7 +3983,7 @@
     char *outstart;
     Py_ssize_t outsize = PyBytes_GET_SIZE(outobj);
 
-    if (mapping->ob_type == &EncodingMapType) {
+    if (Py_Type(mapping) == &EncodingMapType) {
         int res = encoding_map_lookup(c, mapping);
 	Py_ssize_t requiredsize = *outpos+1;
         if (res == -1)
@@ -4056,7 +4055,7 @@
     /* find all unencodable characters */
     while (collendpos < size) {
         PyObject *rep;
-        if (mapping->ob_type == &EncodingMapType) {
+        if (Py_Type(mapping) == &EncodingMapType) {
 	    int res = encoding_map_lookup(p[collendpos], mapping);
 	    if (res != -1)
 		break;
@@ -5114,7 +5113,7 @@
 	    PyErr_Format(PyExc_TypeError,
 			 "sequence item %zd: expected string or Unicode,"
 			 " %.80s found",
-			 i, item->ob_type->tp_name);
+			 i, Py_Type(item)->tp_name);
 	    goto onError;
 	}
 	item = PyUnicode_FromObject(item);
@@ -6155,7 +6154,7 @@
         PyErr_Format(PyExc_TypeError,
                      "encoder did not return a bytes object "
                      "(type=%.400s)",
-                     v->ob_type->tp_name);
+                     Py_Type(v)->tp_name);
         Py_DECREF(v);
         return NULL;
     }
@@ -6191,7 +6190,7 @@
         PyErr_Format(PyExc_TypeError,
                      "decoder did not return a string/unicode object "
                      "(type=%.400s)",
-                     v->ob_type->tp_name);
+                     Py_Type(v)->tp_name);
         Py_DECREF(v);
         return NULL;
     }
@@ -8134,7 +8133,7 @@
 	arglen = -1;
 	argidx = -2;
     }
-    if (args->ob_type->tp_as_mapping && !PyTuple_Check(args) &&
+    if (Py_Type(args)->tp_as_mapping && !PyTuple_Check(args) &&
         !PyObject_TypeCheck(args, &PyBaseString_Type))
 	dict = args;
 
@@ -8604,8 +8603,7 @@
 static PyObject *unicode_iter(PyObject *seq);
 
 PyTypeObject PyUnicode_Type = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0, 					/* ob_size */
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "str", 				/* tp_name */
     sizeof(PyUnicodeObject), 		/* tp_size */
     0, 					/* tp_itemsize */
@@ -8902,8 +8900,7 @@
 };
 
 PyTypeObject PyUnicodeIter_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,					/* ob_size */
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"unicodeiterator",			/* tp_name */
 	sizeof(unicodeiterobject),		/* tp_basicsize */
 	0,					/* tp_itemsize */

Modified: python/branches/py3k-struni/Objects/weakrefobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/weakrefobject.c	(original)
+++ python/branches/py3k-struni/Objects/weakrefobject.c	Sat Jul 21 19:22:18 2007
@@ -105,7 +105,7 @@
 {
     PyObject_GC_UnTrack(self);
     clear_weakref((PyWeakReference *) self);
-    self->ob_type->tp_free(self);
+    Py_Type(self)->tp_free(self);
 }
 
 
@@ -172,7 +172,7 @@
 		      name ? "<weakref at %p; to '%.50s' at %p (%s)>"
 		           : "<weakref at %p; to '%.50s' at %p>",
 		      self,
-		      PyWeakref_GET_OBJECT(self)->ob_type->tp_name,
+		      Py_Type(PyWeakref_GET_OBJECT(self))->tp_name,
 		      PyWeakref_GET_OBJECT(self),
 		      name);
 	Py_XDECREF(nameobj);
@@ -276,10 +276,10 @@
         PyWeakReference *ref, *proxy;
         PyWeakReference **list;
 
-        if (!PyType_SUPPORTS_WEAKREFS(ob->ob_type)) {
+        if (!PyType_SUPPORTS_WEAKREFS(Py_Type(ob))) {
             PyErr_Format(PyExc_TypeError,
                          "cannot create weak reference to '%s' object",
-                         ob->ob_type->tp_name);
+                         Py_Type(ob)->tp_name);
             return NULL;
         }
         if (callback == Py_None)
@@ -334,8 +334,7 @@
 
 PyTypeObject
 _PyWeakref_RefType = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "weakref",
     sizeof(PyWeakReference),
     0,
@@ -449,7 +448,7 @@
     char buf[160];
     PyOS_snprintf(buf, sizeof(buf),
 		  "<weakproxy at %p to %.100s at %p>", proxy,
-		  PyWeakref_GET_OBJECT(proxy)->ob_type->tp_name,
+		  Py_Type(PyWeakref_GET_OBJECT(proxy))->tp_name,
 		  PyWeakref_GET_OBJECT(proxy));
     return PyUnicode_FromString(buf);
 }
@@ -644,8 +643,7 @@
 
 PyTypeObject
 _PyWeakref_ProxyType = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "weakproxy",
     sizeof(PyWeakReference),
     0,
@@ -678,8 +676,7 @@
 
 PyTypeObject
 _PyWeakref_CallableProxyType = {
-    PyObject_HEAD_INIT(&PyType_Type)
-    0,
+    PyVarObject_HEAD_INIT(&PyType_Type, 0)
     "weakcallableproxy",
     sizeof(PyWeakReference),
     0,
@@ -718,10 +715,10 @@
     PyWeakReference **list;
     PyWeakReference *ref, *proxy;
 
-    if (!PyType_SUPPORTS_WEAKREFS(ob->ob_type)) {
+    if (!PyType_SUPPORTS_WEAKREFS(Py_Type(ob))) {
         PyErr_Format(PyExc_TypeError,
 		     "cannot create weak reference to '%s' object",
-                     ob->ob_type->tp_name);
+                     Py_Type(ob)->tp_name);
         return NULL;
     }
     list = GET_WEAKREFS_LISTPTR(ob);
@@ -777,10 +774,10 @@
     PyWeakReference **list;
     PyWeakReference *ref, *proxy;
 
-    if (!PyType_SUPPORTS_WEAKREFS(ob->ob_type)) {
+    if (!PyType_SUPPORTS_WEAKREFS(Py_Type(ob))) {
         PyErr_Format(PyExc_TypeError,
 		     "cannot create weak reference to '%s' object",
-                     ob->ob_type->tp_name);
+                     Py_Type(ob)->tp_name);
         return NULL;
     }
     list = GET_WEAKREFS_LISTPTR(ob);
@@ -803,9 +800,9 @@
             PyWeakReference *prev;
 
             if (PyCallable_Check(ob))
-                result->ob_type = &_PyWeakref_CallableProxyType;
+                Py_Type(result) = &_PyWeakref_CallableProxyType;
             else
-                result->ob_type = &_PyWeakref_ProxyType;
+                Py_Type(result) = &_PyWeakref_ProxyType;
             get_basic_refs(*list, &ref, &proxy);
             if (callback == NULL) {
                 if (proxy != NULL) {
@@ -870,7 +867,7 @@
     PyWeakReference **list;
 
     if (object == NULL
-        || !PyType_SUPPORTS_WEAKREFS(object->ob_type)
+        || !PyType_SUPPORTS_WEAKREFS(Py_Type(object))
         || object->ob_refcnt != 0) {
         PyErr_BadInternalCall();
         return;

Modified: python/branches/py3k-struni/PC/_msi.c
==============================================================================
--- python/branches/py3k-struni/PC/_msi.c	(original)
+++ python/branches/py3k-struni/PC/_msi.c	Sat Jul 21 19:22:18 2007
@@ -417,8 +417,7 @@
 };
 
 static PyTypeObject record_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_msi.Record",		/*tp_name*/
 	sizeof(msiobj),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -584,8 +583,7 @@
 };
 
 static PyTypeObject summary_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_msi.SummaryInformation",		/*tp_name*/
 	sizeof(msiobj),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -733,8 +731,7 @@
 };
 
 static PyTypeObject msiview_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_msi.View",		/*tp_name*/
 	sizeof(msiobj),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/
@@ -851,8 +848,7 @@
 };
 
 static PyTypeObject msidb_Type = {
-	PyObject_HEAD_INIT(NULL)
-	0,			/*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"_msi.Database",		/*tp_name*/
 	sizeof(msiobj),	/*tp_basicsize*/
 	0,			/*tp_itemsize*/

Modified: python/branches/py3k-struni/PC/_winreg.c
==============================================================================
--- python/branches/py3k-struni/PC/_winreg.c	(original)
+++ python/branches/py3k-struni/PC/_winreg.c	Sat Jul 21 19:22:18 2007
@@ -459,8 +459,7 @@
 /* The type itself */
 PyTypeObject PyHKEY_Type =
 {
-	PyObject_HEAD_INIT(0) /* fill in type at module init */
-	0,
+	PyVarObject_HEAD_INIT(0, 0) /* fill in type at module init */
 	"PyHKEY",
 	sizeof(PyHKEYObject),
 	0,

Modified: python/branches/py3k-struni/Python/ceval.c
==============================================================================
--- python/branches/py3k-struni/Python/ceval.c	(original)
+++ python/branches/py3k-struni/Python/ceval.c	Sat Jul 21 19:22:18 2007
@@ -3158,7 +3158,7 @@
 		*--sp = PyList_GET_ITEM(l, ll - j);
 	}
 	/* Resize the list. */
-	((PyListObject *)l)->ob_size = ll - argcntafter;
+	Py_Size(l) = ll - argcntafter;
 	Py_DECREF(it);
 	return 1;
 
@@ -3644,7 +3644,7 @@
 	}
 	if (argdefs != NULL) {
 		d = &PyTuple_GET_ITEM(argdefs, 0);
-		nd = ((PyTupleObject *)argdefs)->ob_size;
+		nd = Py_Size(argdefs);
 	}
 	return PyEval_EvalCodeEx(co, globals,
 				 (PyObject *)NULL, (*pp_stack)-n, na,

Modified: python/branches/py3k-struni/Python/import.c
==============================================================================
--- python/branches/py3k-struni/Python/import.c	(original)
+++ python/branches/py3k-struni/Python/import.c	Sat Jul 21 19:22:18 2007
@@ -3050,8 +3050,7 @@
 
 
 static PyTypeObject NullImporterType = {
-	PyObject_HEAD_INIT(NULL)
-	0,                         /*ob_size*/
+	PyVarObject_HEAD_INIT(NULL, 0)
 	"imp.NullImporter",        /*tp_name*/
 	sizeof(NullImporter),      /*tp_basicsize*/
 	0,                         /*tp_itemsize*/

Modified: python/branches/py3k-struni/Python/marshal.c
==============================================================================
--- python/branches/py3k-struni/Python/marshal.c	(original)
+++ python/branches/py3k-struni/Python/marshal.c	Sat Jul 21 19:22:18 2007
@@ -150,7 +150,7 @@
 			PyLongObject *ob = (PyLongObject *)v;
 			PyErr_Clear();
 			w_byte(TYPE_LONG, p);
-			n = ob->ob_size;
+			n = Py_Size(ob);
 			w_long((long)n, p);
 			if (n < 0)
 				n = -n;
@@ -571,7 +571,7 @@
 				retval = NULL;
 				break;
 			}
-			ob->ob_size = n;
+			Py_Size(ob) = n;
 			for (i = 0; i < size; i++) {
 				int digit = r_short(p);
 				if (digit < 0) {

Modified: python/branches/py3k-struni/Python/symtable.c
==============================================================================
--- python/branches/py3k-struni/Python/symtable.c	(original)
+++ python/branches/py3k-struni/Python/symtable.c	Sat Jul 21 19:22:18 2007
@@ -119,8 +119,7 @@
 };
 
 PyTypeObject PySTEntry_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"symtable entry",
 	sizeof(PySTEntryObject),
 	0,

Modified: python/branches/py3k-struni/Python/traceback.c
==============================================================================
--- python/branches/py3k-struni/Python/traceback.c	(original)
+++ python/branches/py3k-struni/Python/traceback.c	Sat Jul 21 19:22:18 2007
@@ -52,8 +52,7 @@
 }
 
 PyTypeObject PyTraceBack_Type = {
-	PyObject_HEAD_INIT(&PyType_Type)
-	0,
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 	"traceback",
 	sizeof(PyTracebackObject),
 	0,


More information about the Python-3000-checkins mailing list