From f6d6480b93eca6f353784579108957108750c004 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 6 Jul 2017 10:22:50 +0200 Subject: [PATCH] [2.7] bpo-30855: Trying to fix test_use on Windows. (#2586) * bpo-30855: Trying to fix test_use on Windows. Avoid possible weird behavior of WideInt convertion. "winfo id" always returns string hexadecimal representation. (cherry picked from commit b9d672491d5082c541bf267eb7bb99fdc6529324) * bpo-30855: Trying to fix test_use on Windows. (cherry picked from commit 29a2f7c6b38e5a6ed891aa72af38974a1ff2d372) (subTest() removed since it was introduced in Python 3) --- Lib/lib-tk/Tkinter.py | 3 +-- Lib/lib-tk/test/test_tkinter/test_widgets.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 874e0ef8a0..6198c4c949 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -844,8 +844,7 @@ class Misc: self.tk.call('winfo', 'height', self._w)) def winfo_id(self): """Return identifier ID for this widget.""" - return self.tk.getint( - self.tk.call('winfo', 'id', self._w)) + return int(self.tk.call('winfo', 'id', self._w), 0) def winfo_interps(self, displayof=0): """Return the name of all Tcl interpreters for this display.""" args = ('winfo', 'interps') + self._displayof(displayof) diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py index 4da309617e..1c4c4f3f6e 100644 --- a/Lib/lib-tk/test/test_tkinter/test_widgets.py +++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py @@ -88,9 +88,9 @@ class ToplevelTest(AbstractToplevelTest, unittest.TestCase): widget = self.create() self.assertEqual(widget['use'], '') parent = self.create(container=True) - wid = parent.winfo_id() + wid = hex(parent.winfo_id()) widget2 = self.create(use=wid) - self.assertEqual(int(widget2['use']), wid) + self.assertEqual(widget2['use'], wid) @add_standard_options(StandardOptionsTests) -- 2.50.1