ctypes should have an option to *not* catch c++ exceptions
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Payload đề cập đến mô-đun ctypes nhưng không có tệp nguồn hay bài kiểm thử nào. Hãy bắt đầu bằng cách xác định đường dẫn bắt ngoại lệ gốc của ctypes và xem xét cách việc chuyển đổi ngoại lệ Python hiện tại được kiểm thử. So sánh một công tắc toàn cục với PYTHON_CTYPES_DONT_CATCH_EXCEPTIONS, và xác định hoàn tất khi có một cách được lập tài liệu và kiểm thử để giữ lại các ngoại lệ gốc nhằm gỡ lỗi mà không thay đổi hành vi mặc định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp, python
- Lĩnh vực
- backend, operating-systems
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100