Skip to content

Wrong TypeError message #135915

Closed as duplicate
Closed as duplicate
@Locked-chess-official

Description

@Locked-chess-official

Bug report

Bug description:

>>> type(print).__new__(type(print))
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    type(print).__new__(type(print))
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
TypeError: object.__new__(builtin_function_or_method) is not safe, use builtin_function_or_method.__new__()

The type(print).__new__ is not object.__new__, so the message is wrong. The correct message is "cannot create 'builtin_function_or_method' instances"

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions