]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-130851: Don't crash when deduping unusual code constants (#130853)
authorSam Gross <colesbury@gmail.com>
Wed, 5 Mar 2025 14:04:49 +0000 (09:04 -0500)
committerGitHub <noreply@github.com>
Wed, 5 Mar 2025 14:04:49 +0000 (15:04 +0100)
commit2905690a91bf72cdf0fb919b5193849bb67732e2
tree37fe0620fe7cb82ed55cfe4fe71556874b6d9039
parent78d50e91ff31bc7fd0ac877cf59ee083e94d0915
gh-130851: Don't crash when deduping unusual code constants (#130853)

The bytecode compiler only generates a few different types of constants,
like str, int, tuple, slices, etc. Users can construct code objects with
various unusual constants, including ones that are not hashable or not
even constant.

The free threaded build previously crashed with a fatal error when
confronted with these constants. Instead, treat distinct objects of
otherwise unhandled types as not equal for the purposes of deduplication.
Lib/test/test_code.py
Misc/NEWS.d/next/Core_and_Builtins/2025-03-04-20-33-28.gh-issue-130851.MT9j7n.rst [new file with mode: 0644]
Objects/codeobject.c