[pypy-commit] pypy py3.3: Fix most tcl tests

amauryfa noreply at buildbot.pypy.org
Mon Dec 29 21:28:35 CET 2014


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.3
Changeset: r75144:63b83c822ed6
Date: 2014-12-21 11:16 +0100
http://bitbucket.org/pypy/pypy/changeset/63b83c822ed6/

Log:	Fix most tcl tests

diff --git a/lib-python/3/tkinter/test/test_tkinter/test_variables.py b/lib-python/3/tkinter/test/test_tkinter/test_variables.py
--- a/lib-python/3/tkinter/test/test_tkinter/test_variables.py
+++ b/lib-python/3/tkinter/test/test_tkinter/test_variables.py
@@ -1,4 +1,5 @@
 import unittest
+from test import support
 
 from tkinter import Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tk
 
@@ -42,6 +43,7 @@
         v = Variable(self.root, "sample string", "varname")
         self.assertTrue(self.info_exists("varname"))
         del v
+        support.gc_collect()
         self.assertFalse(self.info_exists("varname"))
 
     def test_dont_unset_not_existing(self):
@@ -49,9 +51,11 @@
         v1 = Variable(self.root, name="name")
         v2 = Variable(self.root, name="name")
         del v1
+        support.gc_collect()
         self.assertFalse(self.info_exists("name"))
         # shouldn't raise exception
         del v2
+        support.gc_collect()
         self.assertFalse(self.info_exists("name"))
 
     def test___eq__(self):
diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py
--- a/lib_pypy/_tkinter/app.py
+++ b/lib_pypy/_tkinter/app.py
@@ -359,6 +359,8 @@
             return tuple(result)
         elif isinstance(arg, tuple):
             return self._splitObj(arg)
+        if isinstance(arg, str):
+            arg = arg.encode('utf-8')
         return self._split(arg)
 
     def splitlist(self, arg):
@@ -383,7 +385,7 @@
         if res == tklib.TCL_ERROR:
             self.raiseTclError()
 
-        result = tuple(tkffi.string(argv[0][i]).decode('utf-8')
+        result = tuple(FromTclString(tkffi.string(argv[0][i]))
                        for i in range(argc[0]))
         tklib.Tcl_Free(argv[0])
         return result
@@ -427,13 +429,13 @@
             # Not a list.
             # Could be a quoted string containing funnies, e.g. {"}.
             # Return the string itself.
-            return arg.decode('utf-8')
+            return FromTclString(arg)
 
         try:
             if argc[0] == 0:
                 return ""
             elif argc[0] == 1:
-                return tkffi.string(argv[0][0])
+                return FromTclString(tkffi.string(argv[0][0]))
             else:
                 return tuple(self._split(argv[0][i])
                              for i in range(argc[0]))


More information about the pypy-commit mailing list