Skip to content

Commit abf438d

Browse files
gh-151881: Skip tk_inactive negativity check on Windows
On Windows ``Tk_GetUserInactiveTime()`` computes the inactivity interval as a C ``long``, which is only 32-bit there. On a non-interactive session (e.g. a buildbot running as a service) the interval can exceed 2**31 ms and overflow to a negative value, making the test fail. Guard the lower-bound check on the win32 windowing system pending the Tk-side fix (Tk ticket 3cb7c4ac72d4). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ecdef17 commit abf438d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_tkinter/test_misc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,11 @@ def test_tk_inactive(self):
592592
ms = self.root.tk_inactive()
593593
self.assertIsInstance(ms, int)
594594
# A count of milliseconds, or -1 if the windowing system lacks support.
595-
self.assertGreaterEqual(ms, -1)
595+
if self.root._windowingsystem != 'win32':
596+
# On Windows the inactivity time is computed as a C long, which is
597+
# only 32-bit there, so on a non-interactive session it can exceed
598+
# 2**31 ms and overflow to a negative value (Tk ticket 3cb7c4ac72d4).
599+
self.assertGreaterEqual(ms, -1)
596600
# Resetting the timer returns None and does not raise.
597601
self.assertIsNone(self.root.tk_inactive(reset=True))
598602

0 commit comments

Comments
 (0)