Dead code in tkinter
オープン
まだ誰も着手していません。
3.16
extension-modules
topic-tkinter
type-refactor
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
Modules/_tkinter.c always defines TCL_THREADS:
/* If Tcl is compiled for threads, we must also define TCL_THREAD. We define
it always; if Tcl is not threaded, the thread functions in
Tcl are empty. */
#define TCL_THREADS
but in two places in Modules/_tkinter.c , we check if TCL_THREADS is defined:
#ifdef TCL_THREADS
static Tcl_ThreadDataKey state_key;
typedef PyThreadState *ThreadSpecificData;
#define tcl_tstate \
(*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
#else
static PyThreadState *tcl_tstate = NULL;
#endif
and
#ifndef TCL_THREADS
if (v->threaded) {
PyErr_SetString(PyExc_RuntimeError,
"Tcl is threaded but _tkinter is not");
Py_DECREF(v);
return 0;
}
#endif
Especially the latter is confusing, as this code block is not compiled and the test is never executed.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-141241
- gh-152841
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Modules/_tkinter.c で TCL_THREADS の定義と、報告書に示されている 2 つの条件ブロックを読むことから始め、既存の作業についてはリンクされている PR gh-141241 と gh-152841 を確認します。報告されたデッドパスを残さず、到達不能な条件コードが一貫して削除または明確化されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c
- 領域
- desktop
- issue の種類
- リファクタリング
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100