Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d56fc582
Commit
d56fc582
authored
Nov 03, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #7317: Display full tracebacks when an error occurs asynchronously.
Patch by Alon Horev with update by Alexey Kachayev.
parent
90e26a27
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
19 deletions
+22
-19
Lib/test/test_cmd_line.py
Lib/test/test_cmd_line.py
+1
-1
Lib/test/test_generators.py
Lib/test/test_generators.py
+10
-11
Misc/NEWS
Misc/NEWS
+3
-0
Python/errors.c
Python/errors.c
+8
-7
No files found.
Lib/test/test_cmd_line.py
View file @
d56fc582
...
...
@@ -310,7 +310,7 @@ class CmdLineTest(unittest.TestCase):
rc
,
out
,
err
=
assert_python_ok
(
'-c'
,
code
)
self
.
assertEqual
(
b''
,
out
)
self
.
assertRegex
(
err
.
decode
(
'ascii'
,
'ignore'
),
'Exception
OSError: .* ignored
'
)
'Exception
ignored in.*
\
n
OSError: .*
'
)
def
test_closed_stdout
(
self
):
# Issue #13444: if stdout has been explicitly closed, we should
...
...
Lib/test/test_generators.py
View file @
d56fc582
...
...
@@ -1728,9 +1728,7 @@ Our ill-behaved code should be invoked during GC:
>>> g = f()
>>> next(g)
>>> del g
>>> sys.stderr.getvalue().startswith(
... "Exception RuntimeError: 'generator ignored GeneratorExit' in "
... )
>>> "RuntimeError: generator ignored GeneratorExit" in sys.stderr.getvalue()
True
>>> sys.stderr = old
...
...
@@ -1840,22 +1838,23 @@ to test.
... sys.stderr = io.StringIO()
... class Leaker:
... def __del__(self):
... raise RuntimeError
... def invoke(message):
... raise RuntimeError(message)
... invoke("test")
...
... l = Leaker()
... del l
... err = sys.stderr.getvalue().strip()
... err.startswith(
... "Exception RuntimeError: RuntimeError() in <"
... )
... err.endswith("> ignored")
... len(err.splitlines())
... "Exception ignored in" in err
... "RuntimeError: test" in err
... "Traceback" in err
... "in invoke" in err
... finally:
... sys.stderr = old
True
True
1
True
True
These refleak tests should perhaps be in a testfile of their own,
...
...
Misc/NEWS
View file @
d56fc582
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins
-----------------
- Issue #7317: Display full tracebacks when an error occurs asynchronously.
Patch by Alon Horev with update by Alexey Kachayev.
- Issue #16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH
not set at all.
...
...
Python/errors.c
View file @
d56fc582
...
...
@@ -798,7 +798,12 @@ PyErr_WriteUnraisable(PyObject *obj)
PyErr_Fetch
(
&
t
,
&
v
,
&
tb
);
f
=
PySys_GetObject
(
"stderr"
);
if
(
f
!=
NULL
&&
f
!=
Py_None
)
{
PyFile_WriteString
(
"Exception "
,
f
);
if
(
obj
)
{
PyFile_WriteString
(
"Exception ignored in: "
,
f
);
PyFile_WriteObject
(
obj
,
f
,
0
);
PyFile_WriteString
(
"
\n
"
,
f
);
}
PyTraceBack_Print
(
tb
,
f
);
if
(
t
)
{
PyObject
*
moduleName
;
char
*
className
;
...
...
@@ -828,15 +833,11 @@ PyErr_WriteUnraisable(PyObject *obj)
PyFile_WriteString
(
className
,
f
);
if
(
v
&&
v
!=
Py_None
)
{
PyFile_WriteString
(
": "
,
f
);
PyFile_WriteObject
(
v
,
f
,
0
);
PyFile_WriteObject
(
v
,
f
,
Py_PRINT_RAW
);
}
PyFile_WriteString
(
"
\n
"
,
f
);
Py_XDECREF
(
moduleName
);
}
if
(
obj
)
{
PyFile_WriteString
(
" in "
,
f
);
PyFile_WriteObject
(
obj
,
f
,
0
);
}
PyFile_WriteString
(
" ignored
\n
"
,
f
);
PyErr_Clear
();
/* Just in case */
}
Py_XDECREF
(
t
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment