[Python-checkins] cpython: Issue #20350. tkapp.splitlist() is now always used instead of unreliable

serhiy.storchaka python-checkins at python.org
Sat Jun 25 17:09:42 EDT 2016


https://hg.python.org/cpython/rev/8d78cd7c4a9e
changeset:   102177:8d78cd7c4a9e
parent:      102172:a8d611eb6173
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Jun 26 00:09:19 2016 +0300
summary:
  Issue #20350. tkapp.splitlist() is now always used instead of unreliable
tkapp.split() in the tkinter package.

files:
  Lib/tkinter/__init__.py |  16 +++++++---------
  Lib/tkinter/tix.py      |  11 +++++------
  2 files changed, 12 insertions(+), 15 deletions(-)


diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -383,7 +383,7 @@
             pass
     def trace_vinfo(self):
         """Return all trace callback information."""
-        return [self._tk.split(x) for x in self._tk.splitlist(
+        return [self._tk.splitlist(x) for x in self._tk.splitlist(
             self._tk.call("trace", "vinfo", self._name))]
     def __eq__(self, other):
         """Comparison for equality (==).
@@ -1043,18 +1043,16 @@
     def winfo_visualid(self):
         """Return the X identifier for the visual for this widget."""
         return self.tk.call('winfo', 'visualid', self._w)
-    def winfo_visualsavailable(self, includeids=0):
+    def winfo_visualsavailable(self, includeids=False):
         """Return a list of all visuals available for the screen
         of this widget.
 
         Each item in the list consists of a visual name (see winfo_visual), a
-        depth and if INCLUDEIDS=1 is given also the X identifier."""
-        data = self.tk.split(
-            self.tk.call('winfo', 'visualsavailable', self._w,
-                     includeids and 'includeids' or None))
-        if isinstance(data, str):
-            data = [self.tk.split(data)]
-        return [self.__winfo_parseitem(x) for x in  data]
+        depth and if includeids is true is given also the X identifier."""
+        data = self.tk.call('winfo', 'visualsavailable', self._w,
+                            'includeids' if includeids else None)
+        data = [self.tk.splitlist(x) for x in self.tk.splitlist(data)]
+        return [self.__winfo_parseitem(x) for x in data]
     def __winfo_parseitem(self, t):
         """Internal function."""
         return t[:1] + tuple(map(self.__winfo_getint, t[1:]))
diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py
--- a/Lib/tkinter/tix.py
+++ b/Lib/tkinter/tix.py
@@ -1106,7 +1106,7 @@
 
     def pages(self):
         # Can't call subwidgets_all directly because we don't want .nbframe
-        names = self.tk.split(self.tk.call(self._w, 'pages'))
+        names = self.tk.splitlist(self.tk.call(self._w, 'pages'))
         ret = []
         for x in names:
             ret.append(self.subwidget(x))
@@ -1152,7 +1152,7 @@
 
     def pages(self):
         # Can't call subwidgets_all directly because we don't want .nbframe
-        names = self.tk.split(self.tk.call(self._w, 'pages'))
+        names = self.tk.splitlist(self.tk.call(self._w, 'pages'))
         ret = []
         for x in names:
             ret.append(self.subwidget(x))
@@ -1575,8 +1575,7 @@
         '''Returns a list of items whose status matches status. If status is
      not specified, the list of items in the "on" status will be returned.
      Mode can be on, off, default'''
-        c = self.tk.split(self.tk.call(self._w, 'getselection', mode))
-        return self.tk.splitlist(c)
+        return self.tk.splitlist(self.tk.call(self._w, 'getselection', mode))
 
     def getstatus(self, entrypath):
         '''Returns the current status of entryPath.'''
@@ -1897,7 +1896,7 @@
                      or a real number following by the word chars
                      (e.g. 3.4chars) that sets the width of the column to the
                      given number of characters."""
-        return self.tk.split(self.tk.call(self._w, 'size', 'column', index,
+        return self.tk.splitlist(self.tk.call(self._w, 'size', 'column', index,
                              *self._options({}, kw)))
 
     def size_row(self, index, **kw):
@@ -1922,7 +1921,7 @@
                      or a real number following by the word chars
                      (e.g. 3.4chars) that sets the height of the row to the
                      given number of characters."""
-        return self.tk.split(self.tk.call(
+        return self.tk.splitlist(self.tk.call(
                     self, 'size', 'row', index, *self._options({}, kw)))
 
     def unset(self, x, y):

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


More information about the Python-checkins mailing list