gh-157892: Fix error check on _Py_hashtable_set() in intern_static() - #157898
Conversation
…tic() _Py_hashtable_set() returns -1 on failure, so the "< -1" check could never be true and the Py_FatalError() call was unreachable.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Please sign the CLA. |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Signed the CLA now, thanks. |
|
Thanks for the review. |
|
Thanks @rishiraj38 for the PR, and @eendebakpt for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @rishiraj38 for the PR, and @eendebakpt for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @rishiraj38 for the PR, and @eendebakpt for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-158299 is a backport of this pull request to the 3.13 branch. |
|
GH-158300 is a backport of this pull request to the 3.14 branch. |
|
GH-158301 is a backport of this pull request to the 3.15 branch. |
_Py_hashtable_set()returns -1 on failure, so the< -1check inintern_static()was never true and thePy_FatalError()path was unreachable. Check< 0instead.No test added, since the failure path is an allocation failure during startup that ends in a fatal error. Built with
--with-pydebugand rantest_str,test_sys,test_embed,test_capi.test_unicodeandtest_unicode_identifiers.This probably qualifies for
skip news.intern_static()never detects a failed_Py_hashtable_set()(< -1should be< 0) #157892