If we fail to import doctest.UnexpectedException during postmortem, fail quietly and continue
This commit is contained in:
@@ -95,13 +95,17 @@ def _enter_pdb(node, excinfo, rep):
|
||||
|
||||
|
||||
def _postmortem_traceback(excinfo):
|
||||
# A doctest.UnexpectedException is not useful for post_mortem.
|
||||
# Use the underlying exception instead:
|
||||
from doctest import UnexpectedException
|
||||
if isinstance(excinfo.value, UnexpectedException):
|
||||
return excinfo.value.exc_info[2]
|
||||
else:
|
||||
return excinfo._excinfo[2]
|
||||
try:
|
||||
from doctest import UnexpectedException
|
||||
if isinstance(excinfo.value, UnexpectedException):
|
||||
# A doctest.UnexpectedException is not useful for post_mortem.
|
||||
# Use the underlying exception instead:
|
||||
return excinfo.value.exc_info[2]
|
||||
except ImportError:
|
||||
# If we fail to import, continue quietly (if we ran out of file descriptors, for example: #1810)
|
||||
pass
|
||||
|
||||
return excinfo._excinfo[2]
|
||||
|
||||
|
||||
def _find_last_non_hidden_frame(stack):
|
||||
|
||||
1
changelog/1810.bugfix
Normal file
1
changelog/1810.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
If we fail to import doctest.UnexpectedException during postmortem, fail quietly and continue.
|
||||
Reference in New Issue
Block a user