Skip to content

Added undefined __new__ method to non-built-in types  #2869

Closed

Description

@moreal

Feature

Currently, non-built-in types (e.g. user defined class) has its __new__ method. So they are different with object.__new__ and it cause error in inspect._signature_from_callable().

RustPython-side

>>>>> type.__new__
<bound method __new__ of <class 'type'>>
>>>>> object.__new__
<bound method __new__ of <class 'object'>>
>>>>> class A:
.....   ...
..... 
>>>>> A.__new__
<bound method __new__ of <class '__main__.A'>>
>>>>> A.__new__ == object.__new__
False

CPython 3.8-side

>>> type.__new__
<built-in method __new__ of type object at 0x7fc673a1c480>
>>> object.__new__
<built-in method __new__ of type object at 0x7fc673a1c620>
>>> class A:
...   ...
... 
>>> A.__new__
<built-in method __new__ of type object at 0x7fc673a1c620>
>>> A.__new__ == object.__new__
True

Python Documentation

Activity

  1. jamestwebber commented on Aug 13, 2021

    @jamestwebber
    Contributor

    I believe solving this would close #2732

  2. moreal commented on Aug 13, 2021

    @moreal
    ContributorAuthor

    I believe solving this would close #2732

    I agree with it.

  3. changed the title [-]Incompatibility for `__new__` built-in method[/-] [+]Added undefined `__new__` method to non-built-in types [/+] on Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    z-ca-2021Tag to track contrubution-academy 2021

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions