@@ -229,6 +229,7 @@ typedef struct {
229229 int dispatching ;
230230 /* We cannot include tclInt.h, as this is internal.
231231 So we cache interesting types here. */
232+ const Tcl_ObjType * OldBooleanType ;
232233 const Tcl_ObjType * BooleanType ;
233234 const Tcl_ObjType * ByteArrayType ;
234235 const Tcl_ObjType * DoubleType ;
@@ -585,7 +586,8 @@ Tkapp_New(const char *screenName, const char *className,
585586 }
586587#endif
587588
588- v -> BooleanType = Tcl_GetObjType ("boolean" );
589+ v -> OldBooleanType = Tcl_GetObjType ("boolean" );
590+ v -> BooleanType = Tcl_GetObjType ("booleanString" );
589591 v -> ByteArrayType = Tcl_GetObjType ("bytearray" );
590592 v -> DoubleType = Tcl_GetObjType ("double" );
591593 v -> IntType = Tcl_GetObjType ("int" );
@@ -1001,15 +1003,18 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
10011003{
10021004 PyObject * result = NULL ;
10031005 TkappObject * app = (TkappObject * )tkapp ;
1006+ Tcl_Interp * interp = Tkapp_Interp (tkapp );
10041007
10051008 if (value -> typePtr == NULL ) {
10061009 return unicodeFromTclStringAndSize (value -> bytes , value -> length );
10071010 }
10081011
1009- if (value -> typePtr == app -> BooleanType ) {
1010- result = value -> internalRep .longValue ? Py_True : Py_False ;
1011- Py_INCREF (result );
1012- return result ;
1012+ if (value -> typePtr == app -> BooleanType ||
1013+ value -> typePtr == app -> OldBooleanType ) {
1014+ int boolValue ;
1015+ if (Tcl_GetBooleanFromObj (interp , value , & boolValue ) == TCL_ERROR )
1016+ return Tkinter_Error (tkapp );
1017+ return PyBool_FromLong (boolValue );
10131018 }
10141019
10151020 if (value -> typePtr == app -> ByteArrayType ) {
@@ -1032,15 +1037,14 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
10321037 PyObject * elem ;
10331038 Tcl_Obj * tcl_elem ;
10341039
1035- status = Tcl_ListObjLength (Tkapp_Interp ( tkapp ) , value , & size );
1040+ status = Tcl_ListObjLength (interp , value , & size );
10361041 if (status == TCL_ERROR )
10371042 return Tkinter_Error (tkapp );
10381043 result = PyTuple_New (size );
10391044 if (!result )
10401045 return NULL ;
10411046 for (i = 0 ; i < size ; i ++ ) {
1042- status = Tcl_ListObjIndex (Tkapp_Interp (tkapp ),
1043- value , i , & tcl_elem );
1047+ status = Tcl_ListObjIndex (interp , value , i , & tcl_elem );
10441048 if (status == TCL_ERROR ) {
10451049 Py_DECREF (result );
10461050 return Tkinter_Error (tkapp );
0 commit comments