Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
42bed01
C traceback code
iritkatriel Oct 5, 2021
a2daa23
add ExceptionGroups support to traceback.py
iritkatriel Oct 8, 2021
261917a
remove 'with X sub-exceptions' line from tracebacks
iritkatriel Oct 24, 2021
7613b43
pass margin instead of margin_char
iritkatriel Oct 25, 2021
d98a72b
update news
iritkatriel Oct 25, 2021
d69916e
excs is tuple, use PyTuple apis. Change check to assertion.
iritkatriel Oct 25, 2021
f5cab69
remove redundant num_excs > 0 check (it is asserted above)
iritkatriel Oct 25, 2021
5170f00
remove cpython_only from exception group tests
iritkatriel Oct 25, 2021
2052c77
handle recursion errors (vert deeply nested EGs)
iritkatriel Oct 25, 2021
5097300
WRITE_INDENTED_MARGIN macro --> write_indented_margin function
iritkatriel Oct 26, 2021
dc21cf8
move new traceback utils to internal/
iritkatriel Oct 26, 2021
d4007b7
test improvements
iritkatriel Oct 26, 2021
169934e
pep7, improve error checking and clarity
iritkatriel Oct 26, 2021
aa4da45
add missing test to cover print_chained with/without parent_label
iritkatriel Oct 26, 2021
6ee84f7
compare the complete expected tb text
iritkatriel Oct 26, 2021
ac7f34c
Update Misc/NEWS.d/next/Core and Builtins/2021-09-26-18-18-50.bpo-452…
iritkatriel Oct 26, 2021
d0d4961
don't need the regex anymore
iritkatriel Oct 26, 2021
5c1015d
remove full-path labels
iritkatriel Oct 29, 2021
83abebd
int --> bool
iritkatriel Oct 29, 2021
16d077d
move code around
iritkatriel Oct 29, 2021
64fb164
Tweak the top-level of traceback box as suggested by Yury
iritkatriel Oct 31, 2021
88019f5
tidy up error handling
iritkatriel Nov 1, 2021
e963835
add limits for width and depth of formatted exception groups
iritkatriel Nov 2, 2021
e85510a
use _PyBaseExceptionGroup_Check macro
iritkatriel Nov 2, 2021
c15a7bd
remove redundant PyErr_Clear
iritkatriel Nov 2, 2021
d8cc6e8
minor tweak - move if out of loop
iritkatriel Nov 2, 2021
61fab3f
remove excess whitespace
iritkatriel Nov 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove excess whitespace
  • Loading branch information
iritkatriel committed Nov 3, 2021
commit 61fab3fc3cd51b443909b87faa59f476351c5c7a
10 changes: 5 additions & 5 deletions Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ def test_exception_group_width_limit(self):
' +---------------- 15 ----------------\n'
' | ValueError: 14\n'
' +---------------- ... ----------------\n'
' | and 985 more exceptions\n'
' | and 985 more exceptions\n'
' +------------------------------------\n')

report = self.get_report(eg)
Expand Down Expand Up @@ -1520,7 +1520,7 @@ def test_exception_group_depth_limit(self):
' +-+---------------- 1 ----------------\n'
' | ValueError: 990\n'
' +---------------- 2 ----------------\n'
' | ... (max_group_depth is 10)\n'
' | ... (max_group_depth is 10)\n'
' +---------------- 3 ----------------\n'
' | ValueError: -990\n'
' +------------------------------------\n'
Expand Down Expand Up @@ -2361,7 +2361,7 @@ def test_max_group_width(self):
f' +---------------- 2 ----------------',
f' | ValueError: 1',
f' +---------------- ... ----------------',
f' | and 1 more exception',
f' | and 1 more exception',
f' +------------------------------------',
f' +---------------- 2 ----------------',
f' | ExceptionGroup: eg2',
Expand All @@ -2370,7 +2370,7 @@ def test_max_group_width(self):
f' +---------------- 2 ----------------',
f' | TypeError: 1',
f' +---------------- ... ----------------',
f' | and 8 more exceptions',
f' | and 8 more exceptions',
f' +------------------------------------',
f'']

Expand All @@ -2393,7 +2393,7 @@ def test_max_group_depth(self):
f' +-+---------------- 1 ----------------',
f' | ValueError: -1',
f' +---------------- 2 ----------------',
f' | ... (max_group_depth is 2)',
f' | ... (max_group_depth is 2)',
f' +---------------- 3 ----------------',
f' | ValueError: 1',
f' +------------------------------------',
Expand Down
4 changes: 2 additions & 2 deletions Lib/traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ def format(self, *, chain=True, _ctx=None):
elif _ctx.exception_group_depth > self.max_group_depth:
# exception group, but depth exceeds limit
yield from _ctx.emit(
f" ... (max_group_depth is {self.max_group_depth})\n")
f"... (max_group_depth is {self.max_group_depth})\n")
else:
# format exception group
is_toplevel = (_ctx.exception_group_depth == 0)
Expand Down Expand Up @@ -939,7 +939,7 @@ def format(self, *, chain=True, _ctx=None):
remaining = num_excs - self.max_group_width
plural = 's' if remaining > 1 else ''
yield from _ctx.emit(
f" and {remaining} more exception{plural}\n")
f"and {remaining} more exception{plural}\n")

if last_exc and _ctx.need_close:
yield (_ctx.indent() +
Expand Down
4 changes: 2 additions & 2 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ print_exception_recursive(struct exception_print_context* ctx, PyObject *value)
/* exception group but depth exceeds limit */

PyObject *line = PyUnicode_FromFormat(
" ... (max_group_depth is %d)\n", ctx->max_group_depth);
"... (max_group_depth is %d)\n", ctx->max_group_depth);

if (line) {
PyObject *f = ctx->file;
Expand Down Expand Up @@ -1286,7 +1286,7 @@ print_exception_recursive(struct exception_print_context* ctx, PyObject *value)
else {
Py_ssize_t excs_remaining = num_excs - ctx->max_group_width;
PyObject *line = PyUnicode_FromFormat(
" and %zd more exception%s\n",
"and %zd more exception%s\n",
excs_remaining, excs_remaining > 1 ? "s" : "");

if (line) {
Expand Down