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

Do not shadow user arguments in generated__new__ by@warnings.deprecated #132159

Closed
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@XuehaiPan

Description

@XuehaiPan

Bug report

Bug description:

Follow comment#132055 (comment)

fromwarningsimportdeprecated@deprecated("MyMeta will go away soon")classMyMeta(type):def__new__(mcs,name,bases,attrs,cls=None):returnsuper().__new__(mcs,name,bases,attrs)classFoo(metaclass=MyMeta,cls='haha'):pass

Output:

$python3 test.pyTraceback (most recent call last):  File "/Users/PanXuehai/Projects/cpython/test.py", line 10, in <module>    class Foo(metaclass=MyMeta, cls='haha'):        passTypeError: MyMeta.__new__() got multiple values for argument 'cls'

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp