*.c: Use `PyVarObject_HEAD_INIT' to initialize type object headers.
[catacomb-python] / pyke / pyke.h
index c453a9c..f8f821a 100644 (file)
@@ -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. */