Regression: 3.13 `traceback.format_list()` breaking behavior change.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
traceback.format_list() no longer works with lines that have breaks in them:
import traceback
import sys
print(f"Python {sys.version_info.major}.{sys.version_info.minor}")
# Frame with multiline text (source + variable annotations)
frames = [('test.py', 10, 'func', 'x = foo + bar\n\t\thello\n\tworld')]
print("\nInput (3 lines):")
print(repr(frames[0][3]))
print("\nOutput from traceback.format_list():")
result = traceback.format_list(frames)[0] # Yes, it't always a 1-element list both on 3.12 adn 3.13.
print(result)
Python 3.12
Input (3 lines):
'x = foo + bar\n\t\thello\n\tworld'
Output from traceback.format_list():
File "test.py", line 10, in func
x = foo + bar
hello
world
Python 3.13
Input (3 lines):
'x = foo + bar\n\t\thello\n\tworld'
Output from traceback.format_list():
File "test.py", line 10, in func
x = foo + bar
This broke bettre_exceptions on 3.13, which was fixed by formatting the traceback manually. Can we either
- Revert to old behavior in 3.15 and maybe document that it was broken in 3.13 and 3.14?
- Document the behavior change?
ref: https://github.com/Qix-/better-exceptions/issues/134
CPython versions tested on:
3.13
Operating systems tested on:
No response
Linked PRs
- gh-153469
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci lo script fornito con Python 3.12 e 3.13, quindi inizia da traceback.format_list(). Esamina la PR collegata gh-153469 e il comportamento circostante di traceback prima di decidere se l'obiettivo sia la compatibilità o la documentazione. Il lavoro è completato quando il comportamento accettato è implementato o documentato e il caso multilinea è coperto dai test pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100