More programmatic access to error locations in the traceback module
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia in Lib/traceback.py, in format_frame_summary(), dove è descritta la logica esistente per le posizioni dettagliate del traceback. Determina come questa logica potrebbe essere separata per esporre i numeri di colonna per una formattazione personalizzata del traceback senza analizzare la stringa restituita. Il lavoro è completato quando i chiamanti possono accedere programmaticamente alle posizioni preservando l’output esistente del traceback.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature or enhancement
I'd like for the traceback module to have a more programmatic way to access the fine-grained error locations that are printed in tracebacks starting in Python 3.11 (PEP 657).
Pitch
The new fine-grained error information in tracebacks is nice. But I'd like to be able to write a custom traceback printer that uses this information and prints it in a different way (I'd like to highlight the characters in the lines of source rather than having ASCII characters under them).
The logic for getting the locations of the printed fine-grained information is present in the traceback module, but unfortunately, it's only present inside of the format_frame_summary() method, which returns a string. That means that to access the information, I have to parse the string.
It would be convenient if the logic in that method were separated out into a separate method that returned the column numbers, so that it could be called from a superclass. I would be fine if this method is private, so that it wouldn't strictly speaking add a new API or hard-code the existing traceback information into the API.
Previous discussion
I haven't followed the discussions on PEP 657 so I don't know if this has been discussed previously. I don't see any mention of the traceback module in the PEP.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Merge medio
- 1g 9h
- PR unite (30g)
- 558
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.
Altre issue di python/cpython
-
docs pending
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
stdlib type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
stdlib type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
build type-bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
stdlib topic-email type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Tutte le issue di python/cpython
Issue simili
-
area/auth bug comp/agent P3 platform/discord type/security
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
NousResearch/hermes-agent#117848 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
bancolombia/sentinel#23 ·
-
test md ApertaCI
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100