Export real functions for things that currently exist as macros / defines / global variables in the C code
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 558
Mô tả
Feature or enhancement
(A clear and concise description of your proposal.)
Pitch
I am writing a python wrapper in a higher level language using the C DLL API. Within certain higher level languages, it is not easily possible to access anything other than the exported functions from the DLL. Macros / defines / global variables are troublesome to interact with from the DLL.
So, If I only have easy access to the function API in my higher level language, type checking sort of becomes an issue due to things like PyList_Check being a macro and PyList_Type being a global variable. Exposing global variables (such as PyList_Type) through function APIs that just return a pointer to the data (for example) prevents a structure re layout from leaking out of the DLL... not to mention gives easier access to the data I need to call a type check function.
For things like PyList_Check that are macros, but are still useful for direct checks, they could be converted to a function API.
(Explain why this feature or enhancement should be implemented and how it would be used.
Add examples, if applicable.)
I do not suggest converting macros / defines cold turkey into a function API... obviously, that could break a lot of code for users of the C library. Instead, provide function alternatives to the items as a parallel API for those of us that can only really call DLL functions in our higher level language. As I go through some of the C API, I do notice areas where a macro and a function form of an API do exist in parallel. It would be nice if we could continue to extend that, especially for type checks.
Previous discussion
Apologies if this is discussed elsewhere. Move or edit as needed.
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
Không có tệp, bài kiểm thử hoặc mục API cụ thể nào được nêu tên. Hãy bắt đầu bằng cách xem xét C DLL API để tìm các macro, define và biến toàn cục được đề cập; xác định một tập hợp giới hạn các phương án thay thế cho hàm và xác minh rằng các mục đã chọn được export và có thể sử dụng từ một wrapper cấp cao hơn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, python
- Lĩnh vực
- api
- 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
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 20/100