]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-130851: Don't crash when deduping unusual code constants (GH-130853) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 Mar 2025 20:22:57 +0000 (21:22 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Mar 2025 20:22:57 +0000 (15:22 -0500)
commite285232c76606e3be7bf216efb1be1e742423e4b
treeea81af2d4fc087d10834fa889e22199efbc61c6b
parent39f7b06d359b10533ac5af7ce5ffc337bccff354
[3.13] gh-130851: Don't crash when deduping unusual code constants (GH-130853) (#130880)

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.
(cherry picked from commit 2905690a91bf72cdf0fb919b5193849bb67732e2)

Co-authored-by: Sam Gross <colesbury@gmail.com>
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