*.c: Use `PyVarObject_HEAD_INIT' to initialize type object headers.
[pyke] / pyke.h
diff --git a/pyke.h b/pyke.h
index e6d465e..b6a5d8d 100644 (file)
--- a/pyke.h
+++ b/pyke.h
@@ -74,6 +74,14 @@ PRIVATE_SYMBOLS;
 #  define Py_SIZE(obj) (((PyVarObject *)(obj))->ob_size)
 #endif
 
+/* Python 3 added internal structure to the various object headers, and
+ * defined a new macro `PyVarObject_HEAD_INIT' to initialize variable-length
+ * static instances correctly.  Define it if it's not already here.
+ */
+#ifndef PyVarObject_HEAD_INIT
+#  define PyVarObject_HEAD_INIT(super, sz) PyObject_HEAD_INIT(super) sz,
+#endif
+
 /*----- Utilities for returning values and exceptions ---------------------*/
 
 /* Returning values. */