[Python-checkins] cpython (2.7): Added missed calls of splitlist().

serhiy.storchaka python-checkins at python.org
Sun Jun 1 10:23:17 CEST 2014


http://hg.python.org/cpython/rev/09b784f0863d
changeset:   90940:09b784f0863d
branch:      2.7
parent:      90936:334b6725b2f7
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Jun 01 11:21:34 2014 +0300
summary:
  Added missed calls of splitlist().

files:
  Lib/lib-tk/test/test_ttk/test_functions.py |   2 -
  Lib/lib-tk/tkFont.py                       |   3 +-
  Lib/lib-tk/ttk.py                          |  11 ++++-----
  3 files changed, 7 insertions(+), 9 deletions(-)


diff --git a/Lib/lib-tk/test/test_ttk/test_functions.py b/Lib/lib-tk/test/test_ttk/test_functions.py
--- a/Lib/lib-tk/test/test_ttk/test_functions.py
+++ b/Lib/lib-tk/test/test_ttk/test_functions.py
@@ -407,8 +407,6 @@
             ('name', 'no_minus', 'value'))
         self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
             ('something', '-children')) # no children
-        self.assertRaises(ValueError, ttk._list_from_layouttuple, tk,
-            ('something', '-children', 'value')) # invalid children
 
 
     def test_val_or_dict(self):
diff --git a/Lib/lib-tk/tkFont.py b/Lib/lib-tk/tkFont.py
--- a/Lib/lib-tk/tkFont.py
+++ b/Lib/lib-tk/tkFont.py
@@ -78,7 +78,8 @@
         if exists:
             self.delete_font = False
             # confirm font exists
-            if self.name not in root.tk.call("font", "names"):
+            if self.name not in root.tk.splitlist(
+                    root.tk.call("font", "names")):
                 raise Tkinter._tkinter.TclError, "named font %s does not already exist" % (self.name,)
             # if font config info supplied, apply it
             if font:
diff --git a/Lib/lib-tk/ttk.py b/Lib/lib-tk/ttk.py
--- a/Lib/lib-tk/ttk.py
+++ b/Lib/lib-tk/ttk.py
@@ -277,6 +277,7 @@
 def _list_from_layouttuple(tk, ltuple):
     """Construct a list from the tuple returned by ttk::layout, this is
     somewhat the reverse of _format_layoutlist."""
+    ltuple = tk.splitlist(ltuple)
     res = []
 
     indx = 0
@@ -295,8 +296,6 @@
             indx += 2
 
             if opt == 'children':
-                if not tk.wantobjects():
-                    val = tk.splitlist(val)
                 val = _list_from_layouttuple(tk, val)
 
             opts[opt] = val
@@ -410,8 +409,8 @@
             return _list_from_statespec(self.tk.splitlist(
                 self.tk.call(self._name, "map", style, '-%s' % query_opt)))
 
-        return _dict_from_tcltuple(
-            self.tk.call(self._name, "map", style, *(_format_mapdict(kw))))
+        return _dict_from_tcltuple(self.tk.splitlist(
+            self.tk.call(self._name, "map", style, *(_format_mapdict(kw)))))
 
 
     def lookup(self, style, option, state=None, default=None):
@@ -465,8 +464,8 @@
             lspec = "null" # could be any other word, but this may make sense
                            # when calling layout(style) later
 
-        return _list_from_layouttuple(self.tk, self.tk.splitlist(
-            self.tk.call(self._name, "layout", style, lspec)))
+        return _list_from_layouttuple(self.tk,
+            self.tk.call(self._name, "layout", style, lspec))
 
 
     def element_create(self, elementname, etype, *args, **kw):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list