@@ -324,10 +324,6 @@ static int quitMainLoop = 0;
324
324
static int errorInCmd = 0 ;
325
325
static PyObject * excInCmd ;
326
326
327
- #ifdef TKINTER_PROTECT_LOADTK
328
- static int tk_load_failed = 0 ;
329
- #endif
330
-
331
327
332
328
static PyObject * Tkapp_UnicodeResult (TkappObject * );
333
329
@@ -532,17 +528,7 @@ Tcl_AppInit(Tcl_Interp *interp)
532
528
return TCL_OK ;
533
529
}
534
530
535
- #ifdef TKINTER_PROTECT_LOADTK
536
- if (tk_load_failed ) {
537
- PySys_WriteStderr ("Tk_Init error: %s\n" , TKINTER_LOADTK_ERRMSG );
538
- return TCL_ERROR ;
539
- }
540
- #endif
541
-
542
531
if (Tk_Init (interp ) == TCL_ERROR ) {
543
- #ifdef TKINTER_PROTECT_LOADTK
544
- tk_load_failed = 1 ;
545
- #endif
546
532
PySys_WriteStderr ("Tk_Init error: %s\n" , Tcl_GetStringResult (interp ));
547
533
return TCL_ERROR ;
548
534
}
@@ -635,12 +621,6 @@ Tkapp_New(const char *screenName, const char *className,
635
621
Tcl_SetVar (v -> interp ,
636
622
"_tkinter_skip_tk_init" , "1" , TCL_GLOBAL_ONLY );
637
623
}
638
- #ifdef TKINTER_PROTECT_LOADTK
639
- else if (tk_load_failed ) {
640
- Tcl_SetVar (v -> interp ,
641
- "_tkinter_tk_failed" , "1" , TCL_GLOBAL_ONLY );
642
- }
643
- #endif
644
624
645
625
/* some initial arguments need to be in argv */
646
626
if (sync || use ) {
@@ -702,18 +682,6 @@ Tkapp_New(const char *screenName, const char *className,
702
682
703
683
if (Tcl_AppInit (v -> interp ) != TCL_OK ) {
704
684
PyObject * result = Tkinter_Error (v );
705
- #ifdef TKINTER_PROTECT_LOADTK
706
- if (wantTk ) {
707
- const char * _tkinter_tk_failed ;
708
- _tkinter_tk_failed = Tcl_GetVar (v -> interp ,
709
- "_tkinter_tk_failed" , TCL_GLOBAL_ONLY );
710
-
711
- if ( _tkinter_tk_failed != NULL &&
712
- strcmp (_tkinter_tk_failed , "1" ) == 0 ) {
713
- tk_load_failed = 1 ;
714
- }
715
- }
716
- #endif
717
685
Py_DECREF ((PyObject * )v );
718
686
return (TkappObject * )result ;
719
687
}
@@ -2780,18 +2748,6 @@ _tkinter_tkapp_loadtk_impl(TkappObject *self)
2780
2748
const char * _tk_exists = NULL ;
2781
2749
int err ;
2782
2750
2783
- #ifdef TKINTER_PROTECT_LOADTK
2784
- /* Up to Tk 8.4.13, Tk_Init deadlocks on the second call when the
2785
- * first call failed.
2786
- * To avoid the deadlock, we just refuse the second call through
2787
- * a static variable.
2788
- */
2789
- if (tk_load_failed ) {
2790
- PyErr_SetString (Tkinter_TclError , TKINTER_LOADTK_ERRMSG );
2791
- return NULL ;
2792
- }
2793
- #endif
2794
-
2795
2751
/* We want to guard against calling Tk_Init() multiple times */
2796
2752
CHECK_TCL_APPARTMENT ;
2797
2753
ENTER_TCL
@@ -2811,9 +2767,6 @@ _tkinter_tkapp_loadtk_impl(TkappObject *self)
2811
2767
if (_tk_exists == NULL || strcmp (_tk_exists , "1" ) != 0 ) {
2812
2768
if (Tk_Init (interp ) == TCL_ERROR ) {
2813
2769
Tkinter_Error (self );
2814
- #ifdef TKINTER_PROTECT_LOADTK
2815
- tk_load_failed = 1 ;
2816
- #endif
2817
2770
return NULL ;
2818
2771
}
2819
2772
}
0 commit comments