]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-101266: Fix __sizeof__ for subclasses of int (#101394)
authorMark Dickinson <dickinsm@gmail.com>
Sun, 5 Feb 2023 10:02:53 +0000 (10:02 +0000)
committerGitHub <noreply@github.com>
Sun, 5 Feb 2023 10:02:53 +0000 (10:02 +0000)
commit39017e04b55d4c110787551dc9a0cb753f27d700
tree43c39ae5fa296b5bf195614330b0441d6c96db7a
parent9b60ee976a6b66fe96c2d39051612999c26561e5
gh-101266: Fix __sizeof__ for subclasses of int (#101394)

Fix the behaviour of the `__sizeof__` method (and hence the results returned by `sys.getsizeof`) for subclasses of `int`. Previously, `int` subclasses gave identical results to the `int` base class, ignoring the presence of the instance dictionary.

<!-- gh-issue-number: gh-101266 -->
* Issue: gh-101266
<!-- /gh-issue-number -->
Lib/test/test_long.py
Misc/NEWS.d/next/Core and Builtins/2023-01-28-13-11-52.gh-issue-101266.AxV3OF.rst [new file with mode: 0644]
Objects/boolobject.c
Objects/longobject.c