@@ -852,6 +852,9 @@ Tkapp_CreateFileHandler (self, args)
852852{
853853 PyObject * file , * func , * data ;
854854 int mask , id ;
855+ #if (TK_MAJOR_VERSION * 1000 + TK_MINOR_VERSION ) >= 4001
856+ Tcl_File tfile ;
857+ #endif
855858
856859 if (!PyArg_Parse (args , "(OiO)" , & file , & mask , & func ))
857860 return NULL ;
@@ -867,7 +870,13 @@ Tkapp_CreateFileHandler (self, args)
867870 /* ClientData is: (func, file) */
868871 data = Py_BuildValue ("(OO)" , func , file );
869872
873+ #if (TK_MAJOR_VERSION * 1000 + TK_MINOR_VERSION ) >= 4001
874+ tfile = Tcl_GetFile ((ClientData )id , TCL_UNIX_FD );
875+ /* Oughtta check for null Tcl_File object... */
876+ Tcl_CreateFileHandler (tfile , mask , FileHandler , (ClientData ) data );
877+ #else
870878 Tk_CreateFileHandler ((ClientData ) id , mask , FileHandler , (ClientData ) data );
879+ #endif
871880 /* XXX fileHandlerDict */
872881
873882 Py_INCREF (Py_None );
@@ -881,14 +890,23 @@ Tkapp_DeleteFileHandler (self, args)
881890{
882891 PyObject * file ;
883892 int id ;
884-
893+ #if (TK_MAJOR_VERSION * 1000 + TK_MINOR_VERSION ) >= 4001
894+ Tcl_File tfile ;
895+ #endif
896+
885897 if (!PyArg_Parse (args , "O" , & file ))
886898 return NULL ;
887899 id = GetFileNo (file );
888900 if (id < 0 )
889901 return NULL ;
890902
903+ #if (TK_MAJOR_VERSION * 1000 + TK_MINOR_VERSION ) >= 4001
904+ tfile = Tcl_GetFile ((ClientData ) id , TCL_UNIX_FD );
905+ /* Oughtta check for null Tcl_File object... */
906+ Tcl_DeleteFileHandler (tfile );
907+ #else
891908 Tk_DeleteFileHandler ((ClientData ) id );
909+ #endif
892910 /* XXX fileHandlerDict */
893911 Py_INCREF (Py_None );
894912 return Py_None ;
0 commit comments