This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: New object.__getstate__() method introduced refleaks
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.11
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brandtbucher, corona10, erlendaasland, pablogsal, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2022-04-07 14:56 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 32403 merged corona10, 2022-04-07 17:30
Messages (3)
msg416930 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-04-07 14:56
The following change introduced reference leaks:
commit 884eba3c76916889fd6bff3b37b8552bfb4f9566
Author: Serhiy Storchaka <>
Date:   Wed Apr 6 20:00:14 2022 +0300

    bpo-26579: Add object.__getstate__(). (GH-2821)
    Copying and pickling instances of subclasses of builtin types
    bytearray, set, frozenset, collections.OrderedDict, collections.deque,
    weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
    implemented as slots.

Example of buildbot failure.

AMD64 RHEL8 Refleaks 3.x:

14 tests failed:
    test_bytes test_copy test_datetime test_deque test_descr
    test_distutils test_minidom test_ordered_dict test_pickle test_set
    test_shutil test_tarfile test_typing test_weakset

Example of leak:

$ ./python -m test -R 3:3 test_descr -m test_issue24097
beginning 6 repetitions
test_descr leaked [1, 1, 1] references, sum=3
test_descr failed (reference leak)
msg416935 - (view) Author: Brandt Bucher (brandtbucher) * (Python committer) Date: 2022-04-07 16:25
Found it. This line should be removed:
msg416949 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-04-07 23:27
New changeset e2d78baed385c349d756e96d8f0def0268fa9c4f by Dong-hee Na in branch 'main':
bpo-47250: Fix refleak from object.__getstate__() (GH-32403)
Date User Action Args
2022-04-11 14:59:58adminsetgithub: 91406
2022-04-07 23:27:29corona10setmessages: + msg416949
2022-04-07 23:27:28corona10setstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-04-07 18:12:17AlexWaygoodsettitle: Add object.__getstate__() introduced refleaks -> New object.__getstate__() method introduced refleaks
2022-04-07 17:30:06corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request30428
2022-04-07 16:25:26brandtbuchersetnosy: + brandtbucher
messages: + msg416935
2022-04-07 14:58:17vstinnersettitle: Add object.__getstate__() introduced a refleak -> Add object.__getstate__() introduced refleaks
2022-04-07 14:56:51vstinnercreate