More programmatic access to error locations in the traceback module
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece em Lib/traceback.py, em format_frame_summary(), onde é descrita a lógica existente para localizações detalhadas do traceback. Determine como essa lógica poderia ser separada para expor os números de coluna para formatação personalizada do traceback sem analisar a string retornada. Considera-se concluído quando os chamadores puderem acessar as localizações programaticamente, preservando a saída existente do traceback.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Merge médio
- 1d 9h
- PRs com merge (30d)
- 558
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python/cpython
-
docs pending
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
stdlib type-feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
stdlib type-feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
build type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
stdlib topic-email type-feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Todas as issues de python/cpython
Issues semelhantes
-
fix: inaccuracy ⚠️
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
uabrc/uabrc.github.io#1255 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
ethereum-optimism/factory#64 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 90/100
duckdb/duckdb-python#627 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Add link for tutorial Abertadocumentation
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
Qiskit/qiskit-addon-sqd#376 ·