Skip to content

Commit 8b12c15

Browse files
rishiraj38miss-islington
authored andcommitted
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 a4eb936) Co-authored-by: Rishi Raj <180109771+rishiraj38@users.noreply.github.com>
1 parent e4e5835 commit 8b12c15

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
@@ -15947,7 +15947,7 @@ intern_static(PyInterpreterState *interp, PyObject *s /* stolen */)
1594715947
return Py_NewRef(r);
1594815948
}
1594915949

15950-
if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < -1) {
15950+
if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < 0) {
1595115951
Py_FatalError("failed to intern static string");
1595215952
}
1595315953

0 commit comments

Comments
 (0)