New submission from Dimitri Merejkowsky:
Motivation for the patch came from a tweet[1] of David Beazley:
def SomeError(Exception):
pass
raise SomeError('blah')
(Note the `def` keyword instead of `class`):
If you run that, you get:
> TypeError: exceptions must derive from BaseException
Which is not very helpful.
Attached patch changes the error message to be:
> TypeError: exceptions must derive from BaseException, got NoneType
(By the way, it's very close to what Python2 used to say in this case)
----------
components: Interpreter Core
files: 0001-Fix-error-message-when-raising-with-the-wrong-type.patch
keywords: patch
messages: 279689
nosy: Dimitri Merejkowsky
priority: normal
severity: normal
status: open
title: Unclear error message when raising wrong type of exceptions
type: enhancement
versions: Python 3.7
Added file:
http://bugs.python.org/file45267/0001-Fix-error-message-when-raising-with-the-wrong-type.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28559>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com