[New-bugs-announce] [issue28559] Unclear error message when raising wrong type of exceptions
Dimitri Merejkowsky
report at bugs.python.org
Sat Oct 29 14:16:31 EDT 2016
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 <report at bugs.python.org>
<http://bugs.python.org/issue28559>
_______________________________________
More information about the New-bugs-announce
mailing list