https://github.com/python/cpython/commit/a4eb936727e5f949f5dc8c8a38bf6d325518f29b
commit: a4eb936727e5f949f5dc8c8a38bf6d325518f29b
branch: main
author: Rishi Raj <[email protected]>
committer: eendebakpt <[email protected]>
date: 2026-09-27T21:35:05+02:00
summary:
gh-157892: Fix error check on _Py_hashtable_set() in intern_static() (#157898)
_Py_hashtable_set() returns -1 on failure, so the "< -1" check could never be
true and the Py_FatalError() call was unreachable.
files:
M Objects/unicodeobject.c
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 77de3f735cc42a..8446fdbfcb64a9 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -14588,7 +14588,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");
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]