mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
This commit is contained in:
parent
a892554781
commit
88516a6039
3 changed files with 7 additions and 3 deletions
|
@ -1681,7 +1681,7 @@ Our ill-behaved code should be invoked during GC:
|
||||||
>>> g.next()
|
>>> g.next()
|
||||||
>>> del g
|
>>> del g
|
||||||
>>> sys.stderr.getvalue().startswith(
|
>>> sys.stderr.getvalue().startswith(
|
||||||
... "Exception exceptions.RuntimeError: 'generator ignored GeneratorExit' in "
|
... "Exception RuntimeError: 'generator ignored GeneratorExit' in "
|
||||||
... )
|
... )
|
||||||
True
|
True
|
||||||
>>> sys.stderr = old
|
>>> sys.stderr = old
|
||||||
|
@ -1798,7 +1798,7 @@ to test.
|
||||||
... del l
|
... del l
|
||||||
... err = sys.stderr.getvalue().strip()
|
... err = sys.stderr.getvalue().strip()
|
||||||
... err.startswith(
|
... err.startswith(
|
||||||
... "Exception exceptions.RuntimeError: RuntimeError() in <"
|
... "Exception RuntimeError: RuntimeError() in <"
|
||||||
... )
|
... )
|
||||||
... err.endswith("> ignored")
|
... err.endswith("> ignored")
|
||||||
... len(err.splitlines())
|
... len(err.splitlines())
|
||||||
|
|
|
@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
|
||||||
Core and builtins
|
Core and builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- When printing an unraisable error, don't print exceptions. before the name.
|
||||||
|
This duplicates the behavior whening normally printing exceptions.
|
||||||
|
|
||||||
- Bug #1653736: Properly discard third argument to slot_nb_inplace_power.
|
- Bug #1653736: Properly discard third argument to slot_nb_inplace_power.
|
||||||
|
|
||||||
- PEP 352: Raising a string exception now triggers a TypeError. Attempting to
|
- PEP 352: Raising a string exception now triggers a TypeError. Attempting to
|
||||||
|
|
|
@ -603,7 +603,8 @@ PyErr_WriteUnraisable(PyObject *obj)
|
||||||
PyFile_WriteString("<unknown>", f);
|
PyFile_WriteString("<unknown>", f);
|
||||||
else {
|
else {
|
||||||
char* modstr = PyString_AsString(moduleName);
|
char* modstr = PyString_AsString(moduleName);
|
||||||
if (modstr)
|
if (modstr &&
|
||||||
|
strcmp(modstr, "exceptions") != 0)
|
||||||
{
|
{
|
||||||
PyFile_WriteString(modstr, f);
|
PyFile_WriteString(modstr, f);
|
||||||
PyFile_WriteString(".", f);
|
PyFile_WriteString(".", f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue