Ensure object is class before calling issubclass.

This commit is contained in:
Tim Strazny 2018-04-06 14:40:30 +02:00
parent ec2d8223cf
commit 0cd74dc324
1 changed files with 1 additions and 1 deletions

View File

@ -584,7 +584,7 @@ def raises(expected_exception, *args, **kwargs):
"""
__tracebackhide__ = True
if not issubclass(expected_exception, BaseException):
if not isclass(expected_exception) or not issubclass(expected_exception, BaseException):
for exc in filterfalse(isclass, always_iterable(expected_exception)):
msg = ("exceptions must be old-style classes or"
" derived from BaseException, not %s")