summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-07-05 13:58:24 (GMT)
committerGitHub <noreply@github.com>2017-07-05 13:58:24 (GMT)
commitc48a000c74b48586742c4b7eb42bba93f15953a9 (patch)
tree6700e5468ad0965f2233b32c2e561a923f44184b
parent320ee67f981f766ff55c55ef87d5ef17ce297824 (diff)
downloadcpython-c48a000c74b48586742c4b7eb42bba93f15953a9.zip
cpython-c48a000c74b48586742c4b7eb42bba93f15953a9.tar.gz
cpython-c48a000c74b48586742c4b7eb42bba93f15953a9.tar.bz2
[3.5] bpo-30855: Trying to fix test_use on Windows. (#2585)
* 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)
-rw-r--r--Lib/tkinter/__init__.py3
-rw-r--r--Lib/tkinter/test/test_tkinter/test_widgets.py7
2 files changed, 5 insertions, 5 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 1a3bf88..5eeefbb 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -854,8 +854,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/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py
index c924d55..81b52ea 100644
--- a/Lib/tkinter/test/test_tkinter/test_widgets.py
+++ b/Lib/tkinter/test/test_tkinter/test_widgets.py
@@ -91,9 +91,10 @@ class ToplevelTest(AbstractToplevelTest, unittest.TestCase):
widget = self.create()
self.assertEqual(widget['use'], '')
parent = self.create(container=True)
- wid = parent.winfo_id()
- widget2 = self.create(use=wid)
- self.assertEqual(int(widget2['use']), wid)
+ wid = hex(parent.winfo_id())
+ with self.subTest(wid=wid):
+ widget2 = self.create(use=wid)
+ self.assertEqual(widget2['use'], wid)
@add_standard_options(StandardOptionsTests)