]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-101266: Fix __sizeof__ for subclasses of int (GH-101394) (#101579)
authorMark Dickinson <dickinsm@gmail.com>
Sun, 5 Feb 2023 12:18:56 +0000 (12:18 +0000)
committerGitHub <noreply@github.com>
Sun, 5 Feb 2023 12:18:56 +0000 (12:18 +0000)
commitcf89c16486a4cc297413e17d32082ec4f389d725
treed88bede9a7283f82a514d1e86c5ce4b7db7ef8b6
parent7cbcfbe2fffebfc57c9b50ae937bfbb896401fba
[3.11] gh-101266: Fix __sizeof__ for subclasses of int (GH-101394) (#101579)

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.

(Manual backport of #101394 to the Python 3.11 branch.)
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