mirror of
https://github.com/python/cpython.git
synced 2025-07-29 22:24:49 +00:00
Fix a bug in traceback.format_exception_only() that led to an error
being raised when print_exc() was called without an exception set. In version 2.4, this printed "None", restored that behavior.
This commit is contained in:
parent
a10d3afed2
commit
c7986cee76
3 changed files with 9 additions and 1 deletions
|
@ -170,7 +170,7 @@ def format_exception_only(etype, value):
|
|||
# would throw another exception and mask the original problem.
|
||||
if (isinstance(etype, BaseException) or
|
||||
isinstance(etype, types.InstanceType) or
|
||||
type(etype) is str):
|
||||
etype is None or type(etype) is str):
|
||||
return [_format_final_exc_line(etype, value)]
|
||||
|
||||
stype = etype.__name__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue