Dead code in tkinter
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in Modules/_tkinter.c leggendo la definizione di TCL_THREADS e i due blocchi condizionali mostrati nel report, quindi esamina le PR collegate gh-141241 e gh-152841 per verificare il lavoro già esistente. Il lavoro è completato quando il codice condizionale irraggiungibile è stato rimosso o chiarito in modo coerente, senza lasciare i percorsi morti segnalati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c
- Ambito
- desktop
- Tipo di issue
- Refactoring
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100