Alex Waygood
4b7eb321bc
gh-99180: Make `StackSummary.should_show_carets` private ( #119554 )
2024-05-25 17:08:32 +00:00
Pablo Galindo Salgado
a3e4fec873
gh-118893: Evaluate all statements in the new REPL separately ( #119318 )
...
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-21 23:16:56 +00:00
Serhiy Storchaka
0085c3ae8f
gh-116871: Improve name suggestions in tracebacks (GH-116930)
...
Only include underscored names in name suggestions for AttributeError and
ImportError if the original name was underscored.
2024-05-06 15:53:15 +03:00
Pablo Galindo Salgado
f27f8c790a
gh-111201: A new Python REPL (GH-111567)
...
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-05 21:32:23 +02:00
Hugo van Kemenade
3b3f8dea57
gh-117225: Move colorize functionality to own internal module ( #118283 )
2024-05-01 12:27:06 -06:00
Pablo Galindo Salgado
4a08a75cf4
gh-99180: Remove traceback anchors in return and assign statements that cover all the displayed range ( #112670 )
2024-05-01 14:42:10 +01:00
Pablo Galindo Salgado
345e1e04ec
gh-112730: Make the test suite resilient to color-activation environment variables ( #117672 )
2024-04-24 21:25:22 +01:00
Hugo van Kemenade
975081b11e
gh-117225: Add color to doctest output ( #117583 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-24 14:27:40 +03:00
Jérome Perrin
04fabe22dd
gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359)
...
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-01-16 09:49:24 +00:00
Pablo Galindo Salgado
a03ec20bcd
gh-110721: Remove unused code from suggestions.c after moving PyErr_Display to use the traceback module ( #113712 )
2024-01-08 15:10:45 +00:00
Pablo Galindo Salgado
16448cab44
gh-112730: Use color to highlight error locations (gh-112732)
...
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-12-06 23:29:54 +01:00
William Wen
939fc6d6ea
gh-106922: Support multi-line error locations in traceback (attempt 2) ( #112097 )
2023-12-01 22:18:16 +00:00
Irit Katriel
2c68011780
gh-112332: Deprecate TracebackException.exc_type, add exc_type_str. ( #112333 )
2023-11-28 08:03:25 +00:00
Nikita Sobolev
aa732459c5
gh-111388: Add `show_group` parameter to `traceback.format_exception_only` ( #111390 )
2023-10-27 11:11:26 +01:00
Batuhan Taskaya
78e6d72e38
bpo-43950: handle wide unicode characters in tracebacks ( #28150 )
2023-10-26 07:05:29 +00:00
Pablo Galindo Salgado
90a1b2859f
gh-67224: Show source lines in tracebacks when using the -c option when running Python ( #111200 )
2023-10-26 15:17:28 +09:00
Nikita Sobolev
5e7727b052
gh-111157: Mention `__notes__` in `traceback.format_exception_only` docstring ( #111158 )
2023-10-21 15:30:14 +00:00
Pablo Galindo Salgado
e1d8c65e1d
gh-110805: Allow the repl to show source code and complete tracebacks ( #110775 )
2023-10-13 09:25:37 +00:00
Pablo Galindo Salgado
e7331365b4
gh-110721: Use the traceback module for PyErr_Display() and fallback to the C implementation ( #110702 )
2023-10-12 14:52:14 +00:00
Pablo Galindo Salgado
6275c67ea6
gh-106922: Fix error location for constructs with spaces and parentheses ( #108959 )
2023-09-08 17:18:35 +01:00
Irit Katriel
f4d8e10d0d
gh-105292: Add option to make traceback.TracebackException.format_exception_only recurse into exception groups ( #105294 )
...
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-06-06 11:26:18 +02:00
Jakub Kuczys
a4f72fa39a
gh-89412: Add missing attributes (added in 3.10) to traceback module docs ( #105046 )
2023-06-05 18:10:13 +02:00
Jakub Kuczys
39f6a0489f
GH-89455: Add missing attributes (added in 3.11) to traceback module docs ( #105044 )
2023-05-29 18:28:37 +00:00
Irit Katriel
a679c3d58d
gh-102799: replace sys.exc_info by sys.exception in inspect and traceback modules ( #104032 )
2023-05-01 18:19:47 +01:00
Carey Metcalfe
487f55d580
gh-103895: Improve how invalid `Exception.__notes__` are displayed ( #103897 )
2023-05-01 08:32:04 +01:00
Irit Katriel
e1e9bab006
gh-102778: Add sys.last_exc, deprecate sys.last_type, sys.last_value,sys.last_traceback ( #102779 )
2023-03-18 11:47:11 +00:00
Batuhan Taskaya
57be545959
gh-99103: Normalize specialized traceback anchors against the current line (GH-99145)
...
Automerge-Triggered-By: GH:isidentical
2022-11-12 15:37:25 -08:00
Pablo Galindo Salgado
99e2e60cb2
gh-99139: Improve NameError error suggestion for instances ( #99140 )
2022-11-06 13:52:06 +00:00
Batuhan Taskaya
a41de32942
gh-98878: Use builtins from the bound frame when offering a suggestion ( #98880 )
2022-10-31 13:27:13 +00:00
Batuhan Taskaya
c0f2a5ef91
gh-98744: Prevent column-level decoding crashes on traceback module ( #98824 )
2022-10-29 13:28:20 +01:00
Pablo Galindo Salgado
7cfbb49fcd
gh-91058: Add error suggestions to 'import from' import errors ( #98305 )
2022-10-25 23:56:59 +01:00
Pablo Galindo Salgado
bb56dead33
gh-98254: Include stdlib module names in error messages for NameErrors ( #98255 )
2022-10-15 23:13:33 +01:00
Łukasz Langa
bbc7cd649a
gh-97008: Add a Python implementation of AttributeError and NameError suggestions ( #97022 )
...
Relevant tests moved from test_exceptions to test_traceback to be able to
compare both implementations.
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
2022-10-04 15:31:16 -07:00
Simon-Martin Schröder
46fc584b00
gh-87822: Make traceback module robust to exceptions from repr() of local values (GH-94691)
2022-07-11 10:14:15 +01:00
John Belmonte
da717519ec
gh-93883: elide traceback indicators when possible ( #93994 )
...
* gh-93883: elide traceback indicators when possible
Elide traceback column indicators when the entire line of the
frame is implicated. This reduces traceback length and draws
even more attention to the remaining (very relevant) indicators.
Example:
```
Traceback (most recent call last):
File "query.py", line 99, in <module>
bar()
File "query.py", line 66, in bar
foo()
File "query.py", line 37, in foo
magic_arithmetic('foo')
File "query.py", line 18, in magic_arithmetic
return add_counts(x) / 25
^^^^^^^^^^^^^
File "query.py", line 24, in add_counts
return 25 + query_user(user1) + query_user(user2)
^^^^^^^^^^^^^^^^^
File "query.py", line 32, in query_user
return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
```
Rather than going out of our way to provide indicator coverage
in every traceback test suite, the indicator test suite should
be responible for sufficient coverage (e.g. by adding a basic
exception group test to ensure that margin strings are covered).
2022-07-11 07:40:53 +01:00
Irit Katriel
d4c4a76ed1
gh-89770: Implement PEP-678 - Exception notes (GH-31317)
2022-04-16 19:59:52 +01:00
Irit Katriel
a82baed0e9
bpo-45615: Add missing test for printing traceback for non-exception. Fix traceback.py (GH-30091)
2022-01-02 09:34:03 +00:00
Irit Katriel
5bb7ef2768
bpo-45607: Make it possible to enrich exception displays via setting their __note__ field (GH-29880)
2021-12-03 22:01:15 +00:00
Irit Katriel
4dfae6f38e
bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726)
2021-11-27 22:00:10 +00:00
Irit Katriel
3509b26c91
bpo-45292: [PEP 654] Update traceback display code to work with exception groups (GH-29207)
2021-11-05 09:39:18 +00:00
Pablo Galindo Salgado
fe0d9e22a5
bpo-45249: Fix caret location when end_offset is set to 0 (GH-28855)
2021-10-16 10:27:43 -07:00
Pablo Galindo Salgado
20f439b6b9
bpo-45249: Ensure the traceback module prints correctly syntax errors with ranges (GH-28575)
2021-09-27 21:59:06 +01:00
Irit Katriel
9e31b3952f
bpo-41031: Match C and Python code formatting of unprintable exceptions and exceptions in the __main__ module. (GH-28139)
2021-09-05 18:54:13 +03:00
Irit Katriel
0b58e863df
bpo-45075: distinguish between frame and FrameSummary in traceback mo… (GH-28112)
2021-09-03 22:39:23 +01:00
Irit Katriel
863154c929
bpo-31299: make it possible to filter out frames from tracebacks (GH-28067)
2021-08-31 21:42:08 +01:00
Batuhan Taskaya
3e235e0447
bpo-43950: support some multi-line expressions for PEP 657 (GH-27339)
...
This is basically something that I noticed up while fixing test runs for another issue. It is really common to have multiline calls, and when they fail the display is kind of weird since we omit the annotations. E.g;
```
$ ./python t.py
Traceback (most recent call last):
File "/home/isidentical/cpython/cpython/t.py", line 11, in <module>
frame_1()
^^^^^^^^^
File "/home/isidentical/cpython/cpython/t.py", line 5, in frame_1
frame_2(
File "/home/isidentical/cpython/cpython/t.py", line 2, in frame_2
return a / 0 / b / c
~~^~~
ZeroDivisionError: division by zero
```
This patch basically adds support for annotating the rest of the line, if the instruction covers multiple lines (start_line != end_line).
Automerge-Triggered-By: GH:isidentical
2021-07-25 15:01:44 -07:00
Batuhan Taskaya
4f5980a4f5
bpo-43950: support long lines in traceback.py (GH-27336)
2021-07-24 20:50:39 +03:00
Ammar Askar
8ce3008585
bpo-44569: Decouple frame formatting in traceback.py (GH-27038)
2021-07-16 13:21:16 +01:00
Batuhan Taskaya
919ad53751
bpo-43950: make BinOp specializations more reliable (GH-27126)
2021-07-16 00:38:11 +01:00
Batuhan Taskaya
1890dd235f
bpo-43950: Specialize tracebacks for subscripts/binary ops (GH-27037)
...
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-07-12 20:32:33 +01:00