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.

Author PythonF
Recipients PythonF
Date 2022-03-05.15:33:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646494422.15.0.024229074835.issue46930@roundup.psfhosted.org>
In-reply-to
Content
When iterating over __dict__ inside a classmethod, accessing __annotations causses RuntimeError: dictionary changed size during iteration.
This only seems to affect Python 3.10.x on a Ubuntu system.

The following can be used to reproduce this issue:

class ExampleCls:
    @classmethod
    def iter_cls(cls):
        for name, val in cls.__dict__.items():
            print(cls.__annotations__)


This can be fixed for this Example by calling  _ = cls.__annotations__ before iterating over the __dict__
History
Date User Action Args
2022-03-05 15:33:42PythonFsetrecipients: + PythonF
2022-03-05 15:33:42PythonFsetmessageid: <1646494422.15.0.024229074835.issue46930@roundup.psfhosted.org>
2022-03-05 15:33:42PythonFlinkissue46930 messages
2022-03-05 15:33:42PythonFcreate