`_overload_dummy` raises `NotImplementedError`, not `RuntimeError` by sobolevn · Pull Request #98351 · python/cpython
Source:
| def _overload_dummy(*args, **kwds): | |
| """Helper for @overload to raise when called.""" | |
| raise NotImplementedError( | |
| "You should not call an overloaded function. " | |
| "A series of @overload-decorated functions " | |
| "outside a stub module should always be followed " | |
| "by an implementation that is not @overload-ed.") |
I've found this while looking for implicit abstract classes / methods in CPython.
Test was checking for RuntimeError, it is technically correct:
>>> NotImplementedError.__mro__ (<class 'NotImplementedError'>, <class 'RuntimeError'>, <class 'Exception'>, <class 'BaseException'>, <class 'object'>)
But, we can be more precise. It is a good thing.
I am going to skip creating an issue for this, it is like a typo-fix :)