Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
Metaclass__call__ is expected to run everytime a class is instantiated but in Python 3.13 it only run once.
Minimal reproducer:
class_TypeMetaclass(type):def__call__(cls,*args,**kwargs):print("Metaclass.__call__",cls.__qualname__,args)inst=type.__call__(cls,*args,**kwargs)returninstclassType(metaclass=_TypeMetaclass):def__init__(self,obj):self._obj=objclassFunction(Type):passforiinrange(100):Function(i)
On python 3.12, the output is:
Metaclass.__call__ Function (0,)Metaclass.__call__ Function (1,)Metaclass.__call__ Function (2,)...Metaclass.__call__ Function (98,)Metaclass.__call__ Function (99,)On python 3.13 (docker image3.13.0a3-bullseye), the output is unexpectedly:
Metaclass.__call__ Function (0,)CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done