Follow comment #132055 (comment)
from warnings import deprecated @deprecated("MyMeta will go away soon") class MyMeta(type): def __new__(mcs, name, bases, attrs, cls=None): return super().__new__(mcs, name, bases, attrs) class Foo(metaclass=MyMeta, cls='haha'): pass
Output:
$ python3 test.py Traceback (most recent call last): File "/Users/PanXuehai/Projects/cpython/test.py", line 10, in <module> class Foo(metaclass=MyMeta, cls='haha'): pass TypeError: MyMeta.__new__() got multiple values for argument 'cls'
3.13
macOS
gh-132159: Do not shadow user arguments in generated `__new__` by `@w…
pythongh-132159: Do not shadow user arguments in generated `__new__` …
[3.13] gh-132159: Do not shadow user arguments in generated `__new__`…
Activity
gh-132159: Do not shadow user arguments in generated `__new__` by `@w…
pythongh-132159: Do not shadow user arguments in generated `__new__` …
[3.13] gh-132159: Do not shadow user arguments in generated `__new__`…