From dedb6b3830b69aed3e477112814b209b7d17bbaf Mon Sep 17 00:00:00 2001 From: Bill Sommerfeld Date: Mon, 5 Feb 2024 13:43:05 -0800 Subject: [PATCH] More patch cleanups. --- components/python/python-312/TODO | 9 ++ .../python-312/patches-todo/19-pty.patch | 63 -------------- .../python-312/patches-todo/29-Setup.patch | 11 --- .../20-test_fixes.patch | 84 +++++++------------ .../24-strxfrm-fix.patch | 13 ++- .../37-test-zipfile.patch | 8 +- 6 files changed, 51 insertions(+), 137 deletions(-) delete mode 100644 components/python/python-312/patches-todo/19-pty.patch delete mode 100644 components/python/python-312/patches-todo/29-Setup.patch rename components/python/python-312/{patches-todo => patches}/20-test_fixes.patch (82%) rename components/python/python-312/{patches-todo => patches}/24-strxfrm-fix.patch (78%) rename components/python/python-312/{patches-todo => patches}/37-test-zipfile.patch (70%) diff --git a/components/python/python-312/TODO b/components/python/python-312/TODO index 6fee7566dab..53147e68203 100644 --- a/components/python/python-312/TODO +++ b/components/python/python-312/TODO @@ -30,6 +30,13 @@ done: fix modules that aren't loading due to undefined symbols. ---- +probably unnecessary (fixes applied differently upstream): + 19-pty.patch + +patches needing another look: + 20-test_fixes.patch + discarded a patch to test_pyexpat.py that patched something that had been deleted? + double-check that test still passes. patches needing significant work: @@ -70,6 +77,8 @@ patches not needed: 15-gethostname.patch; the spurious declaration of gethostname isn't present in 3.12.1 +29-Setup.patch: we fix curses libraries differently + 42-mod-socket-xpg6.patch: specified options already on command line due to autoconf-based build of modules. 45-system-64-libs.patch: library detection is via autoconf now and doesn't need help diff --git a/components/python/python-312/patches-todo/19-pty.patch b/components/python/python-312/patches-todo/19-pty.patch deleted file mode 100644 index 6125e2c5093..00000000000 --- a/components/python/python-312/patches-todo/19-pty.patch +++ /dev/null @@ -1,63 +0,0 @@ -This patch comes from upstream: http://bugs.python.org/issue26228 -It has not yet been committed, but seems on track to be, and we need -it to fix a bug. ---- Python-3.9.0/Lib/pty.py -+++ Python-3.9.0/Lib/pty.py -@@ -138,7 +138,7 @@ def _copy(master_fd, master_read=_read, - if master_fd in rfds: - data = master_read(master_fd) - if not data: # Reached EOF. -- fds.remove(master_fd) -+ return - else: - os.write(STDOUT_FILENO, data) - if STDIN_FILENO in rfds: -@@ -155,7 +155,15 @@ def spawn(argv, master_read=_read, stdin - sys.audit('pty.spawn', argv) - pid, master_fd = fork() - if pid == CHILD: -- os.execlp(argv[0], *argv) -+ try: -+ os.execlp(argv[0], *argv) -+ except: -+ # If we wanted to be really clever, we would use -+ # the same method as subprocess() to pass the error -+ # back to the parent. For now just dump stack trace. -+ traceback.print_exc() -+ finally: -+ os._exit(1) - try: - mode = tty.tcgetattr(STDIN_FILENO) - tty.setraw(STDIN_FILENO) -@@ -165,6 +173,10 @@ def spawn(argv, master_read=_read, stdin - try: - _copy(master_fd, master_read, stdin_read) - except OSError: -+ # Some OSes never return an EOF on pty, just raise -+ # an error instead. -+ pass -+ finally: - if restore: - tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) - ---- Python-3.9.0/Lib/test/test_pty.py -+++ Python-3.9.0/Lib/test/test_pty.py -@@ -306,7 +306,7 @@ class SmallPtyTests(unittest.TestCase): - socketpair[1].close() - os.close(write_to_stdin_fd) - -- # Expect two select calls, the last one will cause IndexError -+ # Expect two select calls, then a normal return on master EOF - pty.select = self._mock_select - self.select_rfds_lengths.append(2) - self.select_rfds_results.append([mock_stdin_fd, masters[0]]) -@@ -314,8 +314,7 @@ class SmallPtyTests(unittest.TestCase): - # both encountered an EOF before the second select call. - self.select_rfds_lengths.append(0) - -- with self.assertRaises(IndexError): -- pty._copy(masters[0]) -+ pty._copy(masters[0]) - - - def tearDownModule(): diff --git a/components/python/python-312/patches-todo/29-Setup.patch b/components/python/python-312/patches-todo/29-Setup.patch deleted file mode 100644 index f34d592bdbe..00000000000 --- a/components/python/python-312/patches-todo/29-Setup.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Python-3.9.1/Modules/Setup.orig 2021-01-08 00:28:04.485148074 +0000 -+++ Python-3.9.1/Modules/Setup 2021-01-08 00:35:24.857410689 +0000 -@@ -309,7 +309,7 @@ - # provided by the ncurses library. e.g. on Linux, link with -lncurses - # instead of -lcurses). - --#_curses _cursesmodule.c -lcurses -ltermcap -+_curses _cursesmodule.c -lncurses -ltermcap - # Wrapper for the panel library that's part of ncurses and SYSV curses. - #_curses_panel _curses_panel.c -lpanel -lncurses - diff --git a/components/python/python-312/patches-todo/20-test_fixes.patch b/components/python/python-312/patches/20-test_fixes.patch similarity index 82% rename from components/python/python-312/patches-todo/20-test_fixes.patch rename to components/python/python-312/patches/20-test_fixes.patch index 4b59aa57250..fc0a70981ff 100644 --- a/components/python/python-312/patches-todo/20-test_fixes.patch +++ b/components/python/python-312/patches/20-test_fixes.patch @@ -27,18 +27,6 @@ https://github.com/python/cpython/commit/aa967ec4d4c2fc844f8f16b339140b050ae4d5e test_pkgutil doesn't expect that pkg module exists. [Not for upstream] ---- Python-3.9.2/Lib/test/test_gdb.py -+++ Python-3.9.2/Lib/test/test_gdb.py -@@ -52,6 +52,9 @@ if gdb_major_version < 7: - % (gdb_major_version, gdb_minor_version, - gdb_version)) - -+if sys.platform.startswith("sunos"): -+ raise unittest.SkipTest("test doesn't work well on Solaris") -+ - if not sysconfig.is_python_build(): - raise unittest.SkipTest("test_gdb only works on source builds at the moment.") - --- Python-3.9.2/Lib/test/test_unicodedata.py +++ Python-3.9.2/Lib/test/test_unicodedata.py @@ -324,6 +324,8 @@ class NormalizationTest(unittest.TestCas @@ -50,33 +38,6 @@ test_pkgutil doesn't expect that pkg module exists. [Not for upstream] # Hit the exception early try: testdata = open_urlresource(TESTDATAURL, encoding="utf-8", ---- Python-3.9.2/Lib/test/test_re.py -+++ Python-3.9.2/Lib/test/test_re.py -@@ -1,5 +1,6 @@ - from test.support import (gc_collect, bigmemtest, _2G, - cpython_only, captured_stdout) -+import sys - import locale - import re - import sre_compile -@@ -1918,6 +1919,8 @@ ELSE - self.assertTrue(re.match(b'(?Li)\xc5', b'\xe5')) - self.assertTrue(re.match(b'(?Li)\xe5', b'\xc5')) - -+ @unittest.skipIf(sys.platform.startswith("sunos"), -+ "test doesn't work well on sparc Solaris") - def check_en_US_utf8(self): - locale.setlocale(locale.LC_CTYPE, 'en_US.utf8') - self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I)) -@@ -1927,6 +1930,8 @@ ELSE - self.assertIsNone(re.match(b'(?Li)\xc5', b'\xe5')) - self.assertIsNone(re.match(b'(?Li)\xe5', b'\xc5')) - -+ @unittest.skipIf(sys.platform.startswith("sunos"), -+ "test doesn't work well on sparc Solaris") - def test_locale_compiled(self): - oldlocale = locale.setlocale(locale.LC_CTYPE) - self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) --- Python-3.9.2/Lib/test/test_time.py +++ Python-3.9.2/Lib/test/test_time.py @@ -613,7 +613,7 @@ class _TestStrftimeYear: @@ -131,19 +92,6 @@ test_pkgutil doesn't expect that pkg module exists. [Not for upstream] @unittest.skipIf(AIX, "skipping, see issue #22397") def _testFDPassSeparateMinSpace(self): fd0, fd1 = self.newFDs(2) ---- Python-3.9.2/Lib/test/test_pyexpat.py -+++ Python-3.9.2/Lib/test/test_pyexpat.py -@@ -466,8 +466,8 @@ class HandlerExceptionTest(unittest.Test - "pyexpat.c", "StartElement") - self.check_traceback_entry(entries[2], - "test_pyexpat.py", "StartElementHandler") -- if sysconfig.is_python_build() and not (sys.platform == 'win32' and platform.machine() == 'ARM'): -- self.assertIn('call_with_frame("StartElement"', entries[1][3]) -+ #if sysconfig.is_python_build() and not (sys.platform == 'win32' and platform.machine() == 'ARM'): -+ # self.assertIn('call_with_frame("StartElement"', entries[1][3]) - - - # Test Current* members: --- Python-3.9.2/Lib/test/test_tcl.py +++ Python-3.9.2/Lib/test/test_tcl.py @@ -198,6 +198,7 @@ class TclTest(unittest.TestCase): @@ -188,3 +136,35 @@ test_pkgutil doesn't expect that pkg module exists. [Not for upstream] import pkg.subpkg self.addCleanup(unload, 'pkg.subpkg') self.assertEqual(len(pkg.subpkg.__path__), 2) +--- Python-3.12.1/Lib/test/test_gdb/__init__.py.~1~ Thu Dec 7 12:45:44 2023 ++++ Python-3.12.1/Lib/test/test_gdb/__init__.py Mon Feb 5 11:44:20 2024 +@@ -15,6 +15,9 @@ + # debug symbol files. + raise unittest.SkipTest("test_gdb doesn't work on Windows") + ++if sys.platform.startswith("sunos"): ++ raise unittest.SkipTest("test doesn't work well on Solaris") ++ + if support.PGO: + raise unittest.SkipTest("test_gdb is not useful for PGO") + +--- Python-3.12.1/Lib/test/test_re.py.~1~ Thu Dec 7 12:45:44 2023 ++++ Python-3.12.1/Lib/test/test_re.py Mon Feb 5 11:47:36 2024 +@@ -1952,6 +1952,8 @@ + self.assertTrue(re.match(b'(?Li)\xc5', b'\xe5')) + self.assertTrue(re.match(b'(?Li)\xe5', b'\xc5')) + ++ @unittest.skipIf(sys.platform.startswith("sunos"), ++ "test doesn't work well on sparc Solaris") + def check_en_US_utf8(self): + locale.setlocale(locale.LC_CTYPE, 'en_US.utf8') + self.assertTrue(re.match(b'\xc5\xe5', b'\xc5\xe5', re.L|re.I)) +@@ -1965,6 +1967,8 @@ + is_emscripten or is_wasi, + "musl libc issue on Emscripten/WASI, bpo-46390" + ) ++ @unittest.skipIf(sys.platform.startswith("sunos"), ++ "test doesn't work well on sparc Solaris") + def test_locale_compiled(self): + oldlocale = locale.setlocale(locale.LC_CTYPE) + self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale) diff --git a/components/python/python-312/patches-todo/24-strxfrm-fix.patch b/components/python/python-312/patches/24-strxfrm-fix.patch similarity index 78% rename from components/python/python-312/patches-todo/24-strxfrm-fix.patch rename to components/python/python-312/patches/24-strxfrm-fix.patch index 052f7f9885d..678faa69067 100644 --- a/components/python/python-312/patches-todo/24-strxfrm-fix.patch +++ b/components/python/python-312/patches/24-strxfrm-fix.patch @@ -6,21 +6,20 @@ https://bugs.python.org/issue16258 This is not for upstream as the idea is from the bug itself and was rejected for use on all platforms. ---- Python-3.9.1/Modules/_localemodule.c -+++ Python-3.9.1/Modules/_localemodule.c -@@ -363,9 +363,10 @@ Return a string that can be used as a ke - static PyObject* - PyLocale_strxfrm(PyObject* self, PyObject* args) +--- Python-3.12.1/Modules/_localemodule.c.~1~ Thu Dec 7 12:45:44 2023 ++++ Python-3.12.1/Modules/_localemodule.c Mon Feb 5 13:40:46 2024 +@@ -393,8 +393,9 @@ + _locale_strxfrm_impl(PyObject *module, PyObject *str) + /*[clinic end generated code: output=3081866ebffc01af input=1378bbe6a88b4780]*/ { + unsigned int i, j; - PyObject *str; Py_ssize_t n1; - wchar_t *s = NULL, *buf = NULL; + wchar_t *s = NULL, *buf = NULL, *solbuf = NULL; size_t n2; PyObject *result = NULL; -@@ -409,8 +410,23 @@ PyLocale_strxfrm(PyObject* self, PyObjec +@@ -435,8 +436,23 @@ goto exit; } } diff --git a/components/python/python-312/patches-todo/37-test-zipfile.patch b/components/python/python-312/patches/37-test-zipfile.patch similarity index 70% rename from components/python/python-312/patches-todo/37-test-zipfile.patch rename to components/python/python-312/patches/37-test-zipfile.patch index 6e848992e51..e03f23b2254 100644 --- a/components/python/python-312/patches-todo/37-test-zipfile.patch +++ b/components/python/python-312/patches/37-test-zipfile.patch @@ -5,14 +5,14 @@ On illumos, the os.utime() call raises: OSError: [Errno 79] Value too large for defined data type diff -wpruN '--exclude=*.orig' a~/Lib/test/test_zipfile.py a/Lib/test/test_zipfile.py ---- a~/Lib/test/test_zipfile.py 1970-01-01 00:00:00 -+++ a/Lib/test/test_zipfile.py 1970-01-01 00:00:00 -@@ -616,7 +616,7 @@ class StoredTestsWithSourceFile(Abstract +--- Python-3.12.1/Lib/test/test_zipfile/test_core.py.~1~ Thu Dec 7 12:45:44 2023 ++++ Python-3.12.1/Lib/test/test_zipfile/test_core.py Mon Feb 5 12:03:34 2024 +@@ -622,7 +622,7 @@ self.skipTest(f'time.localtime({ts}) raises OverflowError') try: os.utime(TESTFN, (ts, ts)) - except OverflowError: -+ except (OverflowError, OSError): ++ except (OverflowError, OSerror): self.skipTest('Host fs cannot set timestamp to required value.') mtime_ns = os.stat(TESTFN).st_mtime_ns