Skip to content

Some failures in whats_left.sh: method inheritance not as expected #2732

Description

@jamestwebber

Feature

The whats_left.sh script generates a list of incompatibilities by comparing signatures with inspect.signature(). I think one source of mismatches is because of how builtin object inherit (or don't inherit) from object. I don't yet understand how RustPython is doing this so I'm documenting the issue here, but I could write a PR with some help.

Description

As an example: sys.__loader__ is listed by whats_left because signature() returns a ValueError. The CPython signature is (), which is the default signature of object.

In both CPython and RustPython inspect.signature is calling inspect._signature_from_callable() (code), which eventually gets to this block.

The class is an instance of _frozen_importlib.BuiltinImporter which has no __init__ or __new__ method defined. In CPython, both of those methods are the same as the object methods (using the is test, e.g. the same memory address). In RustPython the __new__ method is different. I would guess that something about the class definition is creating a separate __new__ method even though there shouldn't be one.

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