Split Up _testsinglephase.c and _testmultiphase.c
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
(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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず Modules/_testsinglephase.c と Modules/_testmultiphase.c、関連するテスト、gh-124978 を確認し、その後 devguide の extension-module ワークフローに従ってください。完了の条件は、複数モジュールの動作が明示的にカバーされ、含まれる各モジュールに独自のファイルがあり、関連するテストが更新され、元の 2 つのファイルが削除されていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c
- 領域
- build-system, testing
- issue の種類
- リファクタリング
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100