Skip to content

type(...).__name__ is 'EllipsisType' instead of 'ellipsis' #8052

@myers

Description

@myers

Feature

In CPython the type of the ... singleton is named ellipsis (lowercase); types.EllipsisType is just an alias to it. RustPython named the type EllipsisType, so its __name__ and repr disagree with CPython.

Surfaced by running CPython's own stdlib test suite under RustPython — test_json.test_default::test_bad_default fails (its error text embeds type(o).__name__). The minimal standalone reproduction:

Reproduction

print(type(...).__name__)
print(repr(type(...)))

CPython 3.14:

ellipsis
<class 'ellipsis'>

RustPython:

EllipsisType
<class 'EllipsisType'>

(types.EllipsisType is type(...) is True on both — only the name differs. A user-visible consequence: the json encoder's PEP 678 note when serializing {type(o).__name__} object reads EllipsisType instead of ellipsis.)

Python Documentation or reference to CPython source code

  • types.EllipsisType — documented as the type of Ellipsis; its __name__ is ellipsis.
  • CPython's PyEllipsis_Type has tp_name = "ellipsis".
  • RustPython's PyEllipsis is declared #[pyclass(module = false, name = "EllipsisType")]; that name is the type's tp_name.

Suggested fix

Rename the pyclass name to "ellipsis". types.EllipsisType still resolves (it is defined as an alias), and now reports __name__ == 'ellipsis', so the test_bad_default failure above then passes.


Investigated and drafted with AI assistance (Claude Code), reviewed by a human before filing, per RustPython's AI policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions