From ba1342ce998c6c0c36078411d169f29179fbc9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Ogam?= Date: Sun, 1 Jan 2023 16:41:33 +0100 Subject: [PATCH] gh-87980: Fix the error message for disallowed __weakref__ slots (#25362) Fix the error message for disallowed `__weakref__` slots. --- Objects/typeobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 16b1a3035d5..43633f04475 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2712,8 +2712,7 @@ type_new_visit_slots(type_new_ctx *ctx) if (!ctx->may_add_weak || ctx->add_weak != 0) { PyErr_SetString(PyExc_TypeError, "__weakref__ slot disallowed: " - "either we already got one, " - "or __itemsize__ != 0"); + "we already got one"); return -1; } ctx->add_weak++;