More programmatic access to error locations in the traceback module
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza en Lib/traceback.py, en format_frame_summary(), donde se describe la lógica existente para las ubicaciones detalladas del traceback. Determina cómo podría separarse esa lógica para exponer los números de columna para un formateo personalizado del traceback sin analizar la cadena devuelta. Se considera terminado cuando los llamadores pueden acceder programáticamente a las ubicaciones y se conserva la salida existente del traceback.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 36k
- Merge medio
- 1 d 9 h
- PR fusionados (30 d)
- 558
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python/cpython
-
docs pending
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
stdlib type-feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
stdlib type-feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
build type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
stdlib topic-email type-feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Todos los issues de python/cpython
Issues similares
-
area/auth bug comp/agent P3 platform/discord type/security
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
NousResearch/hermes-agent#117848 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
bancolombia/sentinel#23 ·
-
test md AbiertoCI
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100