Skip to content

Commit 7c328b6

Browse files
[3.15] gh-157892: Fix error check on _Py_hashtable_set() in intern_static() (GH-157898) (GH-158301)
_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 a4eb936) Co-authored-by: Rishi Raj <180109771+rishiraj38@users.noreply.github.com>
1 parent d4b1d55 commit 7c328b6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Objects/unicodeobject.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14181,7 +14181,7 @@ intern_static(PyInterpreterState *interp, PyObject *s /* stolen */)
1418114181
return Py_NewRef(r);
1418214182
}
1418314183

14184-
if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < -1) {
14184+
if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < 0) {
1418514185
Py_FatalError("failed to intern static string");
1418614186
}
1418714187

0 commit comments

Comments
 (0)