Make the math module an extension package
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ả
In #81313 a new module math.integer was added. It was implemented as the _math_integer extension module, modified to look like a math submodule. This required assigning the integer attribute of the math module, setting sys.modules['math.integer'], patching the __name__ attribute of the new module and the __module__ attribute of its functions (to support help and pickling). Still, some implementation details are visible: sys.modules['_math_integer'], the __spec__ attribute of the new module. Also, it is difficult to stop importing the math.integer module automatically when the math module is imported.
Import machinery in principle supports extension packages and extension submodules, but there is no precedence of this in the stdlib, and it is not trivial to build them. The math module should be compiled into math/__init__.*.so instead of math.*.so, and math.integer correspondingly into math/integer.*.so. I believe this is possible.
Linked PRs
- gh-141363
- gh-144294
- gh-144339
- gh-152352
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
Bắt đầu bằng cách đọc các PR được liên kết gh-141363, gh-144294, gh-144339 và gh-152352, sau đó lần theo cách mô-đun math và phần mở rộng math.integer được xây dựng và nhập. Kết quả dự kiến là một bố cục gói phần mở rộng tránh việc để lộ _math_integer và siêu dữ liệu đã được vá, cũng như tự động nhập math.integer.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- build-system
- Loại issue
- Tái cấu trúc
- Độ 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
- 25/100