Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python 3.13.0a3 metaclass__call__ runs only once #114806

Closed
Assignees
markshannon
Labels
3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error
@sklam

Description

@sklam

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

3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp