type(...).__name__ is 'EllipsisType' instead of 'ellipsis' #8052
Description
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 ofEllipsis; its__name__isellipsis.- CPython's
PyEllipsis_Typehastp_name = "ellipsis". - RustPython's
PyEllipsisis declared#[pyclass(module = false, name = "EllipsisType")]; thatnameis the type'stp_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.
Activity
fanninpm commentedon Jun 5, 2026
What tests would fail when
EllipsisTypeis absent?myers commentedon Jun 5, 2026
@fanninpm
I think I updated the description after the first post with that info:
test_json.test_default::test_bad_defaultfanninpm commentedon Jun 5, 2026
I think I misunderstood the first time. To be clear,
EllipsisTypeis supposed to be defined inLib/types.pyand nowhere else, correct?myers commentedon Jun 7, 2026
Let me lay out exactly where each piece lives, since "defined" splits into two things — the type vs. the EllipsisType name — and RustPython mirrors CPython here.
The type itself (whose
__name__/tp_nameis "ellipsis", lowercase):#[pyclass(... name = "EllipsisType")]. This name is the bug — it should be "ellipsis".The EllipsisType name is never a type — it's just an alias to that type, exposed by the types module. On both interpreters Lib/types.py does
from _types import *first, with a pure-Python fallback:So to your question: no, it isn't "in types.py and nowhere else" — but every occurrence is an alias computed from the object (type(Ellipsis) / ctx.types.ellipsis_type), not a lookup of the type's name. That's why the fix is just renaming the builtin's name to "ellipsis": types.EllipsisType is type(...) stays True everywhere, and only name/repr change — to match CPython.
shAn-kor commentedon Jul 6, 2026
I’m interested in working on this issue. Is it okay if I take it?
myers commentedon Jul 10, 2026
@shAn-kor I was trying to follow the https://github.com/RustPython/.github/blob/main/AI_POLICY.md. I have a backlog of AI found and fixed changes as I was attempting to get django to work on RustPython. I picked the simplest to put up as an issue. I have a fix, just waiting for this to be "approved".
shAn-kor commentedon Jul 11, 2026
Thanks for letting me know.
youknowone commentedon Aug 11, 2026
@myers I removed the allowlist policy from AI policy. I am sorry to hold you from submitting patches. Could you please submit one now? Thanks!
youknowone commentedon Oct 6, 2026
The originally reported problem no longer reproduces on current main. Closing per the recheck in #8982.
— commented by Grok 4.6