From 81f64e385c1733be7c137cceb5fd840dd26f4bf0 Mon Sep 17 00:00:00 2001 From: David Glick Date: Tue, 27 Aug 2024 09:38:23 -0700 Subject: [PATCH] Fix __weaklistoffset__ in SB_members with USE_EXPLICIT_WEAKREFLIST --- CHANGES.rst | 3 +++ src/zope/interface/_zope_interface_coptimizations.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7243083c..491268b8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,9 @@ 7.0.3 (unreleased) ================== +- Fix `Assertion 'memb->type == T_PYSSIZET' failed.` for Python < 3.12. + (`#319 `_) + 7.0.2 (2024-08-26) ================== diff --git a/src/zope/interface/_zope_interface_coptimizations.c b/src/zope/interface/_zope_interface_coptimizations.c index ed7c5a5f..453057a4 100644 --- a/src/zope/interface/_zope_interface_coptimizations.c +++ b/src/zope/interface/_zope_interface_coptimizations.c @@ -400,7 +400,7 @@ static PyMemberDef SB_members[] = { { "__iro__", T_OBJECT_EX, offsetof(SB, __iro__), 0, "" }, { "__sro__", T_OBJECT_EX, offsetof(SB, __sro__), 0, "" }, #if USE_EXPLICIT_WEAKREFLIST - { "__weaklistoffset__", T_OBJECT_EX, offsetof(SB, weakreflist), 0, "" }, + { "__weaklistoffset__", T_PYSSIZET, offsetof(SB, weakreflist), READONLY, "" }, #endif { NULL }, }; @@ -649,7 +649,7 @@ static PyType_Slot CPB_type_slots[] = { {Py_tp_clear, CPB_clear}, {Py_tp_dealloc, CPB_dealloc}, {Py_tp_members, CPB_members}, - /* tp_base cannot be set as a stot -- pass to PyType_FromModuleAndSpec */ + /* tp_base cannot be set as a slot -- pass to PyType_FromModuleAndSpec */ {0, NULL} };