Commits

rmtew committed 70a46c5 Draft

Fix from Anselm Kruis for Stackless PyTypeObject extra fields being overwritten.

  • Participants
  • Parent commits 58c71e0
  • Branches 2.7-slp

Comments (0)

Files changed (2)

 
 #ifdef STACKLESS
 
+#define VANILLA_PYTYPEOBJECT_SIZE ((size_t) &(((PyTypeObject *)0)->as_number))
+
 /* in Stackless, this is just a synonym */
 #define PyHeapTypeObject PyTypeObject
 

Objects/structseq.c

             n_unnamed_members++;
     n_members = i;
 
+#ifdef STACKLESS
+    if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_STACKLESS_EXTENSION)) {
+        memcpy(type, &_struct_sequence_template, sizeof(PyTypeObject));
+    } else {
+        memcpy(type, &_struct_sequence_template, VANILLA_PYTYPEOBJECT_SIZE);
+    }
+#else
     memcpy(type, &_struct_sequence_template, sizeof(PyTypeObject));
+#endif
     type->tp_name = desc->name;
     type->tp_doc = desc->doc;
     type->tp_basicsize = sizeof(PyStructSequence)+