ctypes should have an option to *not* catch c++ exceptions
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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
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.
Línea de trabajo
El payload menciona el módulo ctypes, pero no ningún archivo fuente ni ninguna prueba. Empieza por localizar la ruta nativa de captura de excepciones de ctypes y revisa cómo se prueba actualmente la conversión de excepciones de Python. Compara un interruptor global con PYTHON_CTYPES_DONT_CATCH_EXCEPTIONS y define como terminado que exista una forma documentada y probada de conservar las excepciones nativas para la depuración sin cambiar el comportamiento predeterminado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp, python
- Área
- backend, operating-systems
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100