Skip to content

Incompatible __prepare__ signature #2762

@sobolevn

Description

@sobolevn

Feature

type.__prepare__ can receive 0 arguments in CPython:

Python 3.9.4 (default, Apr  5 2021, 01:47:16) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> type.__prepare__()
{}

The same happens with 3.8.

But, RustPython requires to pass 2 args:

Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
>>>>> type.__prepare__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Expected at least 2 arguments (0 given)

Python Documentation

https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace
https://www.python.org/dev/peps/pep-3115/#invoking-the-metaclass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions