Split Up _testsinglephase.c and _testmultiphase.c
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ả
(low priority)
Modules/_testsinglephase.c and Modules/_testmultiphase.c both contain the implementations of multiple modules. We should consider splitting up both files, so each contained module has its own file.
Here are several reasons why this may be worth doing:
- testing with a module hidden in another's .so file is awkward and makes those tests harder to understand
- it's easier to accidentally leak C-module global data between modules when they are implemented in the same file
- when adding a new module, it's trickier (less familiar) to implement it in an existing file than in a new file [^1]
[^1]: However, adding it to an existing file is also simpler in how adding a new file involves tweaking the build. See the devguide.
Furthermore, both files were added to test specific import functionality. As far as I can tell[^2], that never included any need for the multiple-modules-in-one-file approach. However, currently they are the only place where we're testing the feature, regardless of how unintentionally or superficially. gh-124978 targets fixing that lack of explicit testing, including moving away from _testsinglephase.c and _testmultiphase.c (e.g. using the dedicated Modules/_testimportmultiple.c).
[^2]: I personally added Modules/_testsinglephase.c and @encukou added _testmultiphase.c.
All that said, splitting up the files is a fairly low priority task. The status quo isn't ideal but it isn't that bad either.
Here's how I see us taking care of this:
- make sure multiple-modules-in-one-file is tested via the dedicated
Modules/_testimportmultiple.c[^2] (see gh-124978) - create the
Modules/_testsinglephasedirectory - move each module from
_testsinglephase.cto its own file (see the devguide) - update the relevant tests
- delete
Modules/_testsinglephase.c - repeat steps 2-5 for
Modules/_testmultiphase.c
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 xem xét Modules/_testsinglephase.c và Modules/_testmultiphase.c, các bài kiểm thử liên quan và gh-124978, sau đó làm theo quy trình extension-module của devguide. Công việc được xem là hoàn tất khi hành vi của nhiều module được bao quát một cách rõ ràng, mỗi module được chứa có tệp riêng, các bài kiểm thử liên quan được cập nhật và cả hai tệp ban đầu đều được xóa.
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
- Lĩnh vực
- build-system, testing
- Loại issue
- Tái cấu trúc
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100