Skip to content

Commit 036d2d6

Browse files
[3.13] gh-157892: Fix error check on _Py_hashtable_set() in intern_static() (GH-157898) (#158299)
_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 33a6511 commit 036d2d6

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
@@ -15200,7 +15200,7 @@ intern_static(PyInterpreterState *interp, PyObject *s /* stolen */)
1520015200
return Py_NewRef(r);
1520115201
}
1520215202

15203-
if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < -1) {
15203+
if (_Py_hashtable_set(INTERNED_STRINGS, s, s) < 0) {
1520415204
Py_FatalError("failed to intern static string");
1520515205
}
1520615206

0 commit comments

Comments
 (0)