Commit graph

188 commits

Author SHA1 Message Date
Miss Islington (bot)
d103357785
[3.13] gh-130250: use support.swap_attr() in test and don't assume we're beginning with a clean system state (GH-130342) (#130344)
gh-130250: use support.swap_attr() in test and don't assume we're beginning with a clean system state (GH-130342)
(cherry picked from commit 048ee2d5ec)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-20 11:52:06 +00:00
Miss Islington (bot)
46237d19d9
[3.13] gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329) (#130330)
gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329)
(cherry picked from commit c718c6be0f)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-20 02:00:49 +00:00
Miss Islington (bot)
d172415a4e
[3.13] gh-130250: fix regression in traceback.print_last (GH-130318) (#130325)
gh-130250: fix regression in traceback.print_last (GH-130318)
(cherry picked from commit 6c982aeb54)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-19 22:06:43 +00:00
Irit Katriel
a853e2f076
[3.13] gh-128799: Add frame of except* to traceback when wrapping a naked exception (#128971) (#129299) 2025-01-30 12:20:13 +00:00
Miss Islington (bot)
7f6e80a03e
[3.13] gh-128894: Fix TracebackException._format_syntax_error on custom SyntaxError metadata (GH-128946) (#129178) 2025-01-22 13:12:39 +00:00
Hugo van Kemenade
afcf238ed4
[3.13] gh-128595: Add test class helper to force no terminal colour (GH-128687) (#128778)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-01-13 13:57:44 +02:00
Miss Islington (bot)
9e37bfae5a
[3.13] gh-125593: Use colors to highlight error locations in tracebacks from exception group (GH-125681) (#126021)
gh-125593: Use colors to highlight error locations in tracebacks from exception group (GH-125681)
(cherry picked from commit 51b012b2a8)

Co-authored-by: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>
2024-10-27 01:23:00 +00:00
Miss Islington (bot)
3b8477b81a
[3.13] gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (GH-125516) (#125524)
gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (GH-125516)
(cherry picked from commit 55c4f4c30b)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-10-15 14:36:14 +00:00
Miss Islington (bot)
99dc0893c7
[3.13] gh-122145: Handle an empty AST body when reporting tracebacks (GH-122161) (#124214)
gh-122145: Handle an empty AST body when reporting tracebacks (GH-122161)
(cherry picked from commit 5cd50cb6eb)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-29 18:13:36 -07:00
Miss Islington (bot)
0a02026a08
[3.13] gh-123123: Fix display of syntax errors covering multiple lines (GH-123131) (#123147)
gh-123123: Fix display of syntax errors covering multiple lines (GH-123131)
(cherry picked from commit 48856ead6a)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-08-19 15:35:47 +00:00
Miss Islington (bot)
a463cd8e45
[3.13] gh-118893: Evaluate all statements in the new REPL separately (GH-119318) (#119408)
(cherry picked from commit a3e4fec873)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 16:22:01 +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
b43c7e1070
gh-112730: Respect tests that require environment variables with no-colorize fixes (#118288) 2024-04-26 21:23:30 +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
Nikita Sobolev
cc573c70b7
gh-115282: Fix direct invocation of test_traceback.py (#115283) 2024-02-11 19:07:08 +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
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
Pablo Galindo Salgado
b3c9faf056
gh-110912: Correctly display tracebacks for MemoryError exceptions using the traceback module (#110921) 2023-10-16 15:39:23 +01: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
Irit Katriel
ecd21a629a
gh-109179: Fix traceback display for SyntaxErrors with notes (#109197) 2023-09-11 19:18:34 +01: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
Serhiy Storchaka
f3ba0a74cd
gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)
Only mark tests which spend significant system or user time,
by itself or in subprocesses.
2023-09-02 07:45:34 +03:00
Nikita Sobolev
7c89f11892
gh-106185: Deduplicate CPythonTracebackErrorCaretTests in test_traceback (GH-106187) 2023-07-25 23:37:47 +03: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
Carey Metcalfe
487f55d580
gh-103895: Improve how invalid Exception.__notes__ are displayed (#103897) 2023-05-01 08:32:04 +01:00
Rodolfo M. Pereira
8291ae31dd
GH-103805: Lib test f541 linting issue fix (#103812)
This PR makes some minor linting adjustments to the Lib/test module
caught by [ruff](https://github.com/charliermarsh/ruff). The adjustments
are all related to the `F541 f-string without any placeholders` issue.

Issue: https://github.com/python/cpython/issues/103805

<!-- gh-issue-number: gh-103805 -->
* Issue: gh-103805
<!-- /gh-issue-number -->

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-24 23:24:49 +00:00
Irit Katriel
482b6eeadc
gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293) 2023-04-06 11:08:25 +01:00
Irit Katriel
5c471f3f2a
gh-102755: PyErr_DisplayException only in ABI >= 3.12. Tests cover PyErr_Display as well (GH-102849) 2023-03-21 10:36:18 +01:00
Irit Katriel
b3cc11a08e
gh-102799: remove unnecessary calls to sys.exc_info() in tests (#102800) 2023-03-18 07:19:38 +00:00
Martin Breuss
00d1ef73d6
Fix typo in code comment (#102726) 2023-03-15 19:18:18 +00:00
Alex Waygood
401d7a7f00
gh-102515: Remove unused imports in the Lib/ directory (#102516) 2023-03-08 11:45:38 +00:00
Pablo Galindo Salgado
0563be23a5
gh-99894: Ensure the local names don't collide with the test file in traceback suggestion error checking (#99895)
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-12-01 14:05:56 +01: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
Irit Katriel
8660604b3e
gh-95259: add test for traceback with angle-bracketed filename (GH-95260) 2022-07-26 14:34:46 +01:00
John Belmonte
1fdc35ef51
gh-93883: Fix some tests involving traceback formatting (#94737)
PR #93994 was merged without being rebased in a few weeks, and
some new test code using the old scheme passed through automatic merge.
2022-07-11 10:22:41 +01: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