From 2c49c759e880a32539f50c31dbd35d2bc4b4e030 Mon Sep 17 00:00:00 2001 From: Christopher Chavez Date: Tue, 6 Jun 2023 05:01:22 -0500 Subject: [PATCH] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) --- Lib/test/test_tcl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index cd79024ab2c8e3..d07b83acb1b505 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -142,7 +142,10 @@ def test_getint(self): for i in self.get_integers(): self.assertEqual(tcl.getint(' %d ' % i), i) self.assertEqual(tcl.getint(' %#o ' % i), i) - self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')), i) + # Numbers starting with 0 are parsed as decimal in Tcl 9.0 + # and as octal in older versions. + self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')), + i if tcl_version < (9, 0) else int('%o' % i)) self.assertEqual(tcl.getint(' %#x ' % i), i) self.assertEqual(tcl.getint(42), 42) self.assertRaises(TypeError, tcl.getint)