ctypes should have an option to *not* catch c++ exceptions
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Feature or enhancement
Proposal:
The ctypes module catches native exceptions and turns them into Python exceptions. In 99.99% of the cases this is exactly what you want, as a Python developer.
But the exception (pun unintended) is when the native exception is repeatable, but only happens in situations where you have no control.
An example is native exceptions that only occur when running your Python code which depends on numerous native libraries on the GitHub Windows runner. I have just had this happen to me for the third time in a couple of years. In the previous two cases the problem was some Python package (or native package it depends on) having a private copy of an outdated MSVC runtime library (or depending on some outdated copy). This is impossible to trace, because it is not repeatable on a development machine, and it isn't even repeatable when capturing the built folder and running the tests on you development machine.
Some mechanism (either a global method in ctypes to disable the exception-catching, or an environment variable PYTHON_CTYPES_DONT_CATCH_EXCEPTIONS) would help immensely, because I could use a debugging Python and a stack trace to pinpoint where the exception happens.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
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.
Direção de pesquisa
O payload menciona o módulo ctypes, mas não especifica nenhum arquivo-fonte nem teste. Comece localizando o caminho nativo de captura de exceções do ctypes e analise como a conversão atual de exceções do Python é testada. Compare uma chave global com PYTHON_CTYPES_DONT_CATCH_EXCEPTIONS e defina como concluído quando houver uma forma documentada e testada de preservar exceções nativas para depuração sem alterar o comportamento padrão.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- cpp, python
- Domínio
- backend, operating-systems
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Ativa
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 42/100