From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:04:21 +0000 (-0700) Subject: [3.11] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105357) X-Git-Tag: v3.11.4~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=daf22ca7f941faac50b437e1c216732eae38a9e9;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105357) gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (cherry picked from commit 2c49c759e880a32539f50c31dbd35d2bc4b4e030) Co-authored-by: Christopher Chavez --- diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index 548914796ed7..cb3ab1d04435 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -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)