New submission from Christian Heimes:

I've tested Tcl 8.5b3, Tk 8.5b3 and Tix 8.4.2 on Windows. IDLE
complained at multiple places that it could not add a Tcl_Obj to a
string (index + "...") or convert it to a float int(float(index)).
Therefor I added an __add__ and __float__ number slot to the C code. I
also had to add two str() calls.

----------
assignee: kbk
components: IDLE
files: py3k_tcltk85.patch
keywords: patch, py3k
messages: 58523
nosy: kbk, tiran
priority: normal
severity: normal
status: open
title: Patch for TCL 8.5 support
type: rfe
versions: Python 3.0
Added file: http://bugs.python.org/file8935/py3k_tcltk85.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1607>
__________________________________
Index: Lib/idlelib/CallTipWindow.py
===================================================================
--- Lib/idlelib/CallTipWindow.py	(revision 59479)
+++ Lib/idlelib/CallTipWindow.py	(working copy)
@@ -60,7 +60,7 @@
 
         self.widget.mark_set(MARK_RIGHT, parenright)
         self.parenline, self.parencol = map(
-            int, self.widget.index(parenleft).split("."))
+            int, str(self.widget.index(parenleft)).split("."))
 
         self.tipwindow = tw = Toplevel(self.widget)
         self.position_window()
Index: Lib/idlelib/EditorWindow.py
===================================================================
--- Lib/idlelib/EditorWindow.py	(revision 59479)
+++ Lib/idlelib/EditorWindow.py	(working copy)
@@ -301,7 +301,7 @@
         self.text.after_idle(self.set_line_and_column)
 
     def set_line_and_column(self, event=None):
-        line, column = self.text.index(INSERT).split('.')
+        line, column = str(self.text.index(INSERT)).split('.')
         self.status_bar.set_label('column', 'Col: %s' % column)
         self.status_bar.set_label('line', 'Ln: %s' % line)
 
Index: Modules/_tkinter.c
===================================================================
--- Modules/_tkinter.c	(revision 59479)
+++ Modules/_tkinter.c	(working copy)
@@ -807,7 +807,62 @@
 	return PyUnicode_FromString(obj->value->typePtr->name);
 }
 
+static PyObject *
+PyTclObject_float(PyObject *self)
+{
+	PyObject *str, *result;
+	
+	str = PyTclObject_str((PyTclObject*)self, NULL);
+	if (str == NULL) {
+		return NULL;
+	}
+	result = PyFloat_FromString(str);
+	Py_DECREF(str);
+	return result;
+}
 
+static PyObject *
+PyTclObject_add(PyObject *a, PyObject *b)
+{
+	PyObject *str, *result;
+
+	if (!PyTclObject_Check(a) || !PyUnicode_Check(b)) {
+		Py_INCREF(Py_NotImplemented);
+		return Py_NotImplemented;
+	}
+	str = PyObject_Str(a);
+	if (str == NULL) {
+		return NULL;
+	}
+	result = PyNumber_Add(str, b);
+	Py_DECREF(str);
+	return result;
+}
+
+static PyNumberMethods PyTclObject_as_number = {
+	(binaryfunc)PyTclObject_add,	/*nb_add*/
+	0,				/*nb_subtract*/
+	0,				/*nb_multiply*/
+	0,				/*nb_remainder*/
+	0,				/*nb_divmod*/
+	0,				/*nb_power*/
+	0,				/*nb_negative*/
+	0,				/*tp_positive*/
+	0,				/*tp_absolute*/
+	0,				/*tp_bool*/
+	0,				/*nb_invert*/
+	0,				/*nb_lshift*/
+	0,				/*nb_rshift*/
+	0,				/*nb_and*/
+	0,				/*nb_xor*/
+	0,				/*nb_or*/
+	0,				/*nb_reserved*/
+	0,				/*nb_int*/
+	0,				/*nb_long*/
+	PyTclObject_float,		/*nb_float*/
+	0,
+};
+
 static PyGetSetDef PyTclObject_getsetlist[] = {
 	{"typename", (getter)get_typename, NULL, get_typename__doc__},
 	{"string", (getter)PyTclObject_string, NULL,
@@ -827,7 +882,7 @@
 	0,			/*tp_setattr*/
 	(cmpfunc)PyTclObject_cmp,	/*tp_compare*/
 	(reprfunc)PyTclObject_repr,	/*tp_repr*/
-	0,			/*tp_as_number*/
+	&PyTclObject_as_number,	/*tp_as_number*/
 	0,			/*tp_as_sequence*/
 	0,			/*tp_as_mapping*/
 	0,			/*tp_hash*/
Index: PCbuild9/_tkinter.vcproj
===================================================================
--- PCbuild9/_tkinter.vcproj	(revision 59479)
+++ PCbuild9/_tkinter.vcproj	(working copy)
@@ -56,7 +56,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltkDir)\lib\tcl84.lib $(tcltkDir)\lib\tk84.lib $(tcltkDir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltkLib)"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -118,7 +118,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltk64Dir)\lib\tcl84.lib $(tcltk64Dir)\lib\tk84.lib $(tcltk64Dir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltk64Lib)"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -180,7 +180,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltkDir)\lib\tcl84.lib $(tcltkDir)\lib\tk84.lib $(tcltkDir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltkLib)"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -243,7 +243,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltk64Dir)\lib\tcl84.lib $(tcltk64Dir)\lib\tk84.lib $(tcltk64Dir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltk64Lib)"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -305,7 +305,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltkDir)\lib\tcl84.lib $(tcltkDir)\lib\tk84.lib $(tcltkDir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltkLib)"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -368,7 +368,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltk64Dir)\lib\tcl84.lib $(tcltk64Dir)\lib\tk84.lib $(tcltk64Dir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltk64Lib)"
 				TargetMachine="17"
 			/>
 			<Tool
@@ -431,7 +431,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltkDir)\lib\tcl84.lib $(tcltkDir)\lib\tk84.lib $(tcltkDir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltkLib)"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -494,7 +494,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="$(tcltk64Dir)\lib\tcl84.lib $(tcltk64Dir)\lib\tk84.lib $(tcltk64Dir)\lib\tix8.4\tix84.lib"
+				AdditionalDependencies="$(tcltk64Lib)"
 				TargetMachine="17"
 			/>
 			<Tool
Index: PCbuild9/build_tkinter.py
===================================================================
--- PCbuild9/build_tkinter.py	(revision 59479)
+++ PCbuild9/build_tkinter.py	(working copy)
@@ -12,10 +12,12 @@
 here = os.path.abspath(os.path.dirname(__file__))
 par = os.path.pardir
 
-TCL = "tcl8.4.16"
-TK = "tk8.4.16"
-TIX = "tix-8.4.0"
-#TIX = "Tix8.4.2"
+#TCL = "tcl8.4.16"
+#TK = "tk8.4.16"
+#TIX = "tix-8.4.0"
+TIX = "Tix8.4.2"
+TCL = "tcl8.5b3"
+TK = "tk8.5b3"
 ROOT = os.path.abspath(os.path.join(here, par, par))
 NMAKE = "nmake /nologo "
 
@@ -35,7 +37,7 @@
 
     # TCL
     tcldir = os.path.join(ROOT, TCL)
-    if True:
+    if 0:
         os.chdir(os.path.join(tcldir, "win"))
         if clean:
             system(NMAKE + "/f makefile.vc clean")
@@ -43,7 +45,7 @@
         system(NMAKE + "/f makefile.vc INSTALLDIR=%s install" % dest)
 
     # TK
-    if True:
+    if 0:
         os.chdir(os.path.join(ROOT, TK, "win"))
         if clean:
             system(NMAKE + "/f makefile.vc clean")
@@ -52,7 +54,7 @@
             (tcldir, dest))
 
     # TIX
-    if True:
+    if 1:
         # python9.mak is available at http://svn.python.org
         os.chdir(os.path.join(ROOT, TIX, "win"))
         if clean:
Index: PCbuild9/pyproject.vsprops
===================================================================
--- PCbuild9/pyproject.vsprops	(revision 59479)
+++ PCbuild9/pyproject.vsprops	(working copy)
@@ -68,4 +68,12 @@
 		Name="tcltk64Dir"
 		Value="..\..\tcltk64"
 	/>
+	<UserMacro
+		Name="tcltkLib"
+		Value="$(tcltkDir)\lib\tcl85.lib $(tcltkDir)\lib\tk85.lib $(tcltkDir)\lib\tix8.4.2\tix84.lib"
+	/>
+	<UserMacro
+		Name="tcltk64Lib"
+		Value="$(tcltk64Dir)\lib\tcl85.lib $(tcltk64Dir)\lib\tk85.lib $(tcltk64Dir)\lib\tix8.4.2\tix84.lib"
+	/>
 </VisualStudioPropertySheet>
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to