Skip to content

Special methods #6658

@terryluan12

Description

@terryluan12

Feature

Using Class.dict.get() will wrap special methods. I noticed this when trying to update the http module.

Example:

class TestClass:
    def __new__(cls, value, phrase, description=''):
        pass

RustPython

>>>>> TestClass.__dict__.get("__new__")
<function TestClass.__new__ at 0x55cee9f8f810>

CPython

>>> TestClass.__dict__.get("__new__")
<staticmethod(<function TestClass.__new__ at 0x7f6444dd4ea0>)>

Python Documentation or reference to CPython source code

https://docs.python.org/3/reference/datamodel.html#object.__new__

Metadata

Metadata

Labels

C-compatA discrepancy between RustPython and CPython

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions