]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105356)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 6 Jun 2023 14:04:07 +0000 (07:04 -0700)
committerGitHub <noreply@github.com>
Tue, 6 Jun 2023 14:04:07 +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 cd79024ab2c8e3bd5f26297e9581b0c3e2f24616..d07b83acb1b505bd7c013e9fb32b4df9198807a4 100644 (file)
@@ -142,7 +142,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)