From: Géry Ogam Date: Sun, 1 Jan 2023 15:41:33 +0000 (+0100) Subject: gh-87980: Fix the error message for disallowed __weakref__ slots (#25362) X-Git-Tag: v3.12.0a4~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba1342ce998c6c0c36078411d169f29179fbc9f6;p=thirdparty%2FPython%2Fcpython.git gh-87980: Fix the error message for disallowed __weakref__ slots (#25362) Fix the error message for disallowed `__weakref__` slots. --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 16b1a3035d56..43633f044751 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++;