cpython icon indicating copy to clipboard operation
cpython copied to clipboard

TypeError for undefined `abstractmethod` does not highlight the undefined method name

Open kaushikcfd opened this issue 3 years ago • 0 comments

Feature or enhancement

Currently, on instantiating a type with an undefined abstract property named "name" we get the following error message:

TypeError: Can't instantiate abstract class IndexNode with abstract method name

The name could be confused as a part of the sentence itself. It must be highlighted, most likely by surrounding the method names with single-quotes

Pitch

Could be implemented via a nondisruptive patch that would edit just the error message in Objects/typeobject.c

Previous discussion

A reference implementation was discussed at https://github.com/python/cpython/pull/97971.

kaushikcfd avatar Oct 15 '22 15:10 kaushikcfd