[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)
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index 874e0ef..6198c4c 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -844,8 +844,7 @@
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 4da3096..1c4c4f3 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 @@
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)