From 9f8b855ddd2ca77ff950d8727a1513c6017fd6cd Mon Sep 17 00:00:00 2001 From: Christopher Chavez Date: Thu, 11 May 2023 19:56:57 -0500 Subject: [PATCH 1/4] gh-104411: Update test_getint for Tcl 9.0 --- Lib/test/test_tcl.py | 4 +++- .../next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index cd79024ab2c8e3..ae623ab9689e68 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -142,7 +142,9 @@ 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) + self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')), + i if tcl_version < (9, 0) else + int(('%#o' % i).replace('o', ''))) self.assertEqual(tcl.getint(' %#x ' % i), i) self.assertEqual(tcl.getint(42), 42) self.assertRaises(TypeError, tcl.getint) diff --git a/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst b/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst new file mode 100644 index 00000000000000..be94a022cd6846 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst @@ -0,0 +1 @@ +Update test_getint for changes to octal integer parsing in Tcl 9.0. \ No newline at end of file From dbc38725b5e277b1119c7491156434440234b636 Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Wed, 17 May 2023 21:30:09 +0400 Subject: [PATCH 2/4] Address the docs check failure --- .../next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst b/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst index be94a022cd6846..c4f62295c355cc 100644 --- a/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst +++ b/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst @@ -1 +1 @@ -Update test_getint for changes to octal integer parsing in Tcl 9.0. \ No newline at end of file +Update test_getint for changes to octal integer parsing in Tcl 9.0. From 36c32b5673ed2f32c806996a49b63a8a78bc9ff0 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 1 Jun 2023 10:26:51 +0300 Subject: [PATCH 3/4] Update Lib/test/test_tcl.py --- Lib/test/test_tcl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index ae623ab9689e68..d07b83acb1b505 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -142,9 +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) + # 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).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) From 07f113e8aab3f60aec552f565d6490988ef26848 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 6 Jun 2023 11:15:11 +0300 Subject: [PATCH 4/4] Delete 2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst A NEWS entry is not needed for this trivial PR. --- .../next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst diff --git a/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst b/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst deleted file mode 100644 index c4f62295c355cc..00000000000000 --- a/Misc/NEWS.d/next/Tests/2023-05-12-00-57-00.gh-issue-104411.H4m2sS.rst +++ /dev/null @@ -1 +0,0 @@ -Update test_getint for changes to octal integer parsing in Tcl 9.0.