]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105357)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 6 Jun 2023 14:04:21 +0000 (07:04 -0700)
committerGitHub <noreply@github.com>
Tue, 6 Jun 2023 14:04:21 +0000 (10:04 -0400)
gh-104411: Update test_getint for Tcl 9.0 (GH-104412)
(cherry picked from commit 2c49c759e880a32539f50c31dbd35d2bc4b4e030)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Lib/test/test_tcl.py

index 548914796ed762806370b39157b66f531b2393aa..cb3ab1d04435c6a2b1d248470737cf47810c67d2 100644 (file)
@@ -145,7 +145,10 @@ class TclTest(unittest.TestCase):
         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)