From: Mark Wooding Date: Tue, 22 Oct 2019 17:53:50 +0000 (+0100) Subject: pyke/pyke.c (newtype): Explicitly clear `ht_slots'. X-Git-Url: https://git.distorted.org.uk/~mdw/pyke/commitdiff_plain/1b026fd1dd2b1565ade497fc9addf0823758430f?ds=sidebyside pyke/pyke.c (newtype): Explicitly clear `ht_slots'. This makes things go very badly wrong in Python 3. I'm not sure why it doesn't go wrong in Python 2... --- diff --git a/pyke.c b/pyke.c index f19c9e4..29dd8c5 100644 --- a/pyke.c +++ b/pyke.c @@ -237,6 +237,7 @@ void *newtype(PyTypeObject *metaty, ty->ht_name = PyString_FromString(ty->ht_type.tp_name); if (ty->ht_name) ty->ht_type.tp_name = PyString_AS_STRING(ty->ht_name); + ty->ht_slots = 0; (void)PyObject_INIT(&ty->ht_type, metaty); Py_INCREF(metaty); return (ty);