From d8ace2a4374c8ce55cb067d9f261767db3ad5dc0 Mon Sep 17 00:00:00 2001 From: Rishi Raj <180109771+rishiraj38@users.noreply.github.com> Date: Mon, 28 Sep 2026 01:05:05 +0530 Subject: [PATCH] gh-157892: Fix error check on _Py_hashtable_set() in intern_static() (GH-157898) _Py_hashtable_set() returns -1 on failure, so the "< -1" check could never be true and the Py_FatalError() call was unreachable. (cherry picked from commit a4eb936727e5f949f5dc8c8a38bf6d325518f29b) Co-authored-by: Rishi Raj <180109771+rishiraj38@users.noreply.github.com> --- Objects/unicodeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 60cd9441462ea11..acb08fa37905fcf 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -15200,7 +15200,7 @@ intern_static(PyInterpreterState *interp, PyObject *s /* stolen */) return Py_NewRef(r); } - if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < -1) { + if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < 0) { Py_FatalError("failed to intern static string"); }