diff --git a/OBS_dev-shm.patch b/OBS_dev-shm.patch deleted file mode 100644 index 32a508c..0000000 --- a/OBS_dev-shm.patch +++ /dev/null @@ -1,175 +0,0 @@ -From 0edba4a774f8fc6867d49ebd2d9c6831901e30dd Mon Sep 17 00:00:00 2001 -From: Victor Stinner -Date: Wed, 17 Jun 2020 17:53:48 +0200 -Subject: [PATCH] bpo-38377: Add - support.skip_if_broken_multiprocessing_synchronize() - -On Linux, skip tests using multiprocessing if the current user cannot -create a file in /dev/shm/ directory. Add the -skip_if_broken_multiprocessing_synchronize() function to the -test.support module. ---- - Doc/library/test.rst | 8 +++++++ - Lib/test/_test_multiprocessing.py | 2 +- - Lib/test/support/__init__.py | 22 +++++++++++++++++++ - Lib/test/test_asyncio/test_events.py | 4 ++-- - Lib/test/test_concurrent_futures.py | 2 +- - Lib/test/test_logging.py | 8 +++---- - .../test_multiprocessing_main_handling.py | 2 +- - Lib/test/test_venv.py | 8 ++++--- - .../2020-06-17-18-00-21.bpo-38377.jfg4TH.rst | 4 ++++ - 9 files changed, 48 insertions(+), 12 deletions(-) - create mode 100644 Misc/NEWS.d/next/Tests/2020-06-17-18-00-21.bpo-38377.jfg4TH.rst - ---- a/Doc/library/test.rst -+++ b/Doc/library/test.rst -@@ -1282,6 +1282,14 @@ The :mod:`test.support` module defines t - - .. versionadded:: 3.6 - -+.. function:: skip_if_broken_multiprocessing_synchronize() -+ -+ Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if -+ there is no available semaphore implementation, or if creating a lock raises -+ an :exc:`OSError`. -+ -+ .. versionadded:: 3.10 -+ - - The :mod:`test.support` module defines the following classes: - ---- a/Lib/test/_test_multiprocessing.py -+++ b/Lib/test/_test_multiprocessing.py -@@ -31,7 +31,7 @@ from test import support - # Skip tests if _multiprocessing wasn't built. - _multiprocessing = test.support.import_module('_multiprocessing') - # Skip tests if sem_open implementation is broken. --test.support.import_module('multiprocessing.synchronize') -+support.skip_if_broken_multiprocessing_synchronize() - import threading - - import multiprocessing.connection ---- a/Lib/test/support/__init__.py -+++ b/Lib/test/support/__init__.py -@@ -3350,3 +3350,25 @@ class catch_threading_exception: - del self.exc_value - del self.exc_traceback - del self.thread -+ -+def skip_if_broken_multiprocessing_synchronize(): -+ """ -+ Skip tests if the multiprocessing.synchronize module is missing, if there -+ is no available semaphore implementation, or if creating a lock raises an -+ OSError. -+ """ -+ -+ # Skip tests if the _multiprocessing extension is missing. -+ import_module('_multiprocessing') -+ -+ # Skip tests if there is no available semaphore implementation: -+ # multiprocessing.synchronize requires _multiprocessing.SemLock. -+ synchronize = import_module('multiprocessing.synchronize') -+ -+ try: -+ # bpo-38377: On Linux, creating a semaphore is the current user -+ # does not have the permission to create a file in /dev/shm. -+ # Create a semaphore to check permissions. -+ synchronize.Lock(ctx=None) -+ except OSError as exc: -+ raise unittest.SkipTest(f"broken multiprocessing SemLock: {exc!r}") ---- a/Lib/test/test_asyncio/test_events.py -+++ b/Lib/test/test_asyncio/test_events.py -@@ -2635,10 +2635,10 @@ class GetEventLoopTestsMixin: - if sys.platform != 'win32': - - def test_get_event_loop_new_process(self): -- # Issue bpo-32126: The multiprocessing module used by -+ # bpo-32126: The multiprocessing module used by - # ProcessPoolExecutor is not functional when the - # multiprocessing.synchronize module cannot be imported. -- support.import_module('multiprocessing.synchronize') -+ support.skip_if_broken_multiprocessing_synchronize() - - async def main(): - pool = concurrent.futures.ProcessPoolExecutor() ---- a/Lib/test/test_concurrent_futures.py -+++ b/Lib/test/test_concurrent_futures.py -@@ -3,7 +3,7 @@ import test.support - # Skip tests if _multiprocessing wasn't built. - test.support.import_module('_multiprocessing') - # Skip tests if sem_open implementation is broken. --test.support.import_module('multiprocessing.synchronize') -+test.support.skip_if_broken_multiprocessing_synchronize() - - from test.support.script_helper import assert_python_ok - ---- a/Lib/test/test_logging.py -+++ b/Lib/test/test_logging.py -@@ -3621,9 +3621,9 @@ if hasattr(logging.handlers, 'QueueListe - - @patch.object(logging.handlers.QueueListener, 'handle') - def test_handle_called_with_mp_queue(self, mock_handle): -- # Issue 28668: The multiprocessing (mp) module is not functional -+ # bpo-28668: The multiprocessing (mp) module is not functional - # when the mp.synchronize module cannot be imported. -- support.import_module('multiprocessing.synchronize') -+ support.skip_if_broken_multiprocessing_synchronize() - for i in range(self.repeat): - log_queue = multiprocessing.Queue() - self.setup_and_log(log_queue, '%s_%s' % (self.id(), i)) -@@ -3647,9 +3647,9 @@ if hasattr(logging.handlers, 'QueueListe - indicates that messages were not registered on the queue until - _after_ the QueueListener stopped. - """ -- # Issue 28668: The multiprocessing (mp) module is not functional -+ # bpo-28668: The multiprocessing (mp) module is not functional - # when the mp.synchronize module cannot be imported. -- support.import_module('multiprocessing.synchronize') -+ support.skip_if_broken_multiprocessing_synchronize() - for i in range(self.repeat): - queue = multiprocessing.Queue() - self.setup_and_log(queue, '%s_%s' %(self.id(), i)) ---- a/Lib/test/test_multiprocessing_main_handling.py -+++ b/Lib/test/test_multiprocessing_main_handling.py -@@ -23,7 +23,7 @@ import multiprocessing - AVAILABLE_START_METHODS = set(multiprocessing.get_all_start_methods()) - - # Issue #22332: Skip tests if sem_open implementation is broken. --support.import_module('multiprocessing.synchronize') -+support.skip_if_broken_multiprocessing_synchronize() - - verbose = support.verbose - ---- a/Lib/test/test_venv.py -+++ b/Lib/test/test_venv.py -@@ -16,7 +16,8 @@ import sys - import tempfile - from test.support import (captured_stdout, captured_stderr, requires_zlib, - can_symlink, EnvironmentVarGuard, rmtree, -- import_module) -+ import_module, -+ skip_if_broken_multiprocessing_synchronize) - import threading - import unittest - import venv -@@ -324,10 +325,11 @@ class BasicTest(BaseTest): - """ - Test that the multiprocessing is able to spawn. - """ -- # Issue bpo-36342: Instanciation of a Pool object imports the -+ # bpo-36342: Instantiation of a Pool object imports the - # multiprocessing.synchronize module. Skip the test if this module - # cannot be imported. -- import_module('multiprocessing.synchronize') -+ skip_if_broken_multiprocessing_synchronize() -+ - rmtree(self.env_dir) - self.run_with_capture(venv.create, self.env_dir) - envpy = os.path.join(os.path.realpath(self.env_dir), ---- /dev/null -+++ b/Misc/NEWS.d/next/Tests/2020-06-17-18-00-21.bpo-38377.jfg4TH.rst -@@ -0,0 +1,4 @@ -+On Linux, skip tests using multiprocessing if the current user cannot create -+a file in ``/dev/shm/`` directory. Add the -+:func:`~test.support.skip_if_broken_multiprocessing_synchronize` function to -+the :mod:`test.support` module. diff --git a/bpo-31046_ensurepip_honours_prefix.patch b/bpo-31046_ensurepip_honours_prefix.patch index 4ee1a3c..d29b5ef 100644 --- a/bpo-31046_ensurepip_honours_prefix.patch +++ b/bpo-31046_ensurepip_honours_prefix.patch @@ -55,7 +55,7 @@ Co-Authored-By: Xavier de Gaye .. note:: --- a/Lib/ensurepip/__init__.py +++ b/Lib/ensurepip/__init__.py -@@ -46,27 +46,27 @@ def _disable_pip_configuration_settings( +@@ -56,27 +56,27 @@ def _disable_pip_configuration_settings( os.environ['PIP_CONFIG_FILE'] = os.devnull @@ -88,8 +88,8 @@ Co-Authored-By: Xavier de Gaye Note that calling this function will alter both sys.path and os.environ. """ -@@ -109,6 +109,8 @@ def _bootstrap(*, root=None, upgrade=Fal - args = ["install", "--no-index", "--find-links", tmpdir] +@@ -119,6 +119,8 @@ def _bootstrap(*, root=None, upgrade=Fal + args = ["install", "--no-cache-dir", "--no-index", "--find-links", tmpdir] if root: args += ["--root", root] + if prefix: @@ -97,7 +97,7 @@ Co-Authored-By: Xavier de Gaye if upgrade: args += ["--upgrade"] if user: -@@ -181,6 +183,11 @@ def _main(argv=None): +@@ -191,6 +193,11 @@ def _main(argv=None): help="Install everything relative to this alternate root directory.", ) parser.add_argument( @@ -109,7 +109,7 @@ Co-Authored-By: Xavier de Gaye "--altinstall", action="store_true", default=False, -@@ -199,6 +206,7 @@ def _main(argv=None): +@@ -209,6 +216,7 @@ def _main(argv=None): return _bootstrap( root=args.root, @@ -127,7 +127,7 @@ Co-Authored-By: Xavier de Gaye + ensurepip.bootstrap(prefix="/foo/bar/") + self.run_pip.assert_called_once_with( + [ -+ "install", "--no-index", "--find-links", ++ "install", "--no-cache-dir", "--no-index", "--find-links", + unittest.mock.ANY, "--prefix", "/foo/bar/", + "setuptools", "pip", + ], diff --git a/bpo40784-Fix-sqlite3-deterministic-test.patch b/bpo40784-Fix-sqlite3-deterministic-test.patch deleted file mode 100644 index bf49d78..0000000 --- a/bpo40784-Fix-sqlite3-deterministic-test.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 00a240bf7f95bbd220f1cfbf9eb58484a5f9681a Mon Sep 17 00:00:00 2001 -From: "Miss Islington (bot)" - <31488909+miss-islington@users.noreply.github.com> -Date: Fri, 29 May 2020 05:46:34 -0700 -Subject: [PATCH] bpo-40784: Fix sqlite3 deterministic test (GH-20448) - -(cherry picked from commit c610d970f5373b143bf5f5900d4645e6a90fb460) - -Co-authored-by: Erlend Egeberg Aasland ---- - Lib/sqlite3/test/userfunctions.py | 36 +++++++++++++++++++++++-------- - 1 file changed, 27 insertions(+), 9 deletions(-) - -diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py -index 9501f535c4999..c11c82e127577 100644 ---- a/Lib/sqlite3/test/userfunctions.py -+++ b/Lib/sqlite3/test/userfunctions.py -@@ -1,8 +1,7 @@ --#-*- coding: iso-8859-1 -*- - # pysqlite2/test/userfunctions.py: tests for user-defined functions and - # aggregates. - # --# Copyright (C) 2005-2007 Gerhard Häring -+# Copyright (C) 2005-2007 Gerhard Häring - # - # This file is part of pysqlite. - # -@@ -158,6 +157,7 @@ def setUp(self): - self.con.create_function("isblob", 1, func_isblob) - self.con.create_function("islonglong", 1, func_islonglong) - self.con.create_function("spam", -1, func) -+ self.con.execute("create table test(t text)") - - def tearDown(self): - self.con.close() -@@ -276,18 +276,36 @@ def CheckAnyArguments(self): - val = cur.fetchone()[0] - self.assertEqual(val, 2) - -+ # Regarding deterministic functions: -+ # -+ # Between 3.8.3 and 3.15.0, deterministic functions were only used to -+ # optimize inner loops, so for those versions we can only test if the -+ # sqlite machinery has factored out a call or not. From 3.15.0 and onward, -+ # deterministic functions were permitted in WHERE clauses of partial -+ # indices, which allows testing based on syntax, iso. the query optimizer. -+ @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "Requires SQLite 3.8.3 or higher") - def CheckFuncNonDeterministic(self): - mock = unittest.mock.Mock(return_value=None) -- self.con.create_function("deterministic", 0, mock, deterministic=False) -- self.con.execute("select deterministic() = deterministic()") -- self.assertEqual(mock.call_count, 2) -- -- @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "deterministic parameter not supported") -+ self.con.create_function("nondeterministic", 0, mock, deterministic=False) -+ if sqlite.sqlite_version_info < (3, 15, 0): -+ self.con.execute("select nondeterministic() = nondeterministic()") -+ self.assertEqual(mock.call_count, 2) -+ else: -+ with self.assertRaises(sqlite.OperationalError): -+ self.con.execute("create index t on test(t) where nondeterministic() is not null") -+ -+ @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "Requires SQLite 3.8.3 or higher") - def CheckFuncDeterministic(self): - mock = unittest.mock.Mock(return_value=None) - self.con.create_function("deterministic", 0, mock, deterministic=True) -- self.con.execute("select deterministic() = deterministic()") -- self.assertEqual(mock.call_count, 1) -+ if sqlite.sqlite_version_info < (3, 15, 0): -+ self.con.execute("select deterministic() = deterministic()") -+ self.assertEqual(mock.call_count, 1) -+ else: -+ try: -+ self.con.execute("create index t on test(t) where deterministic() is not null") -+ except sqlite.OperationalError: -+ self.fail("Unexpected failure while creating partial index") - - @unittest.skipIf(sqlite.sqlite_version_info >= (3, 8, 3), "SQLite < 3.8.3 needed") - def CheckFuncDeterministicNotSupported(self): diff --git a/python38.changes b/python38.changes index ed3fdd7..ccdae85 100644 --- a/python38.changes +++ b/python38.changes @@ -14,6 +14,11 @@ Tue Jul 14 20:27:24 UTC 2020 - Matej Cepl - Vectorcall: a fast calling protocol for CPython (PEP-590) - Pickle protocol 5 with out-of-band data buffers (PEP-574) - Many other smaller bug fixes +- Removed OBS_dev-shm.patch: contained in upstream +- Removed bpo40784-Fix-sqlite3-deterministic-test.patch: + contained in upstream +- Changed bpo-31046_ensurepip_honours_prefix.patch: to be + compatible with new version ------------------------------------------------------------------- Mon Jul 13 11:19:08 UTC 2020 - Callum Farmer diff --git a/python38.spec b/python38.spec index 4b54c0f..40a729f 100644 --- a/python38.spec +++ b/python38.spec @@ -122,10 +122,6 @@ Patch02: F00251-change-user-install-location.patch # PATCH-FEATURE-UPSTREAM SUSE-FEDORA-multilib.patch bsc#[0-9]+ mcepl@suse.com # Add support for platlib variable Patch03: SUSE-FEDORA-multilib.patch -# PATCH-FIX-OPENSUSE OBS_dev-shm.patch bpo#38377 mcepl@suse.com -# _multiprocessing.SemLock depends on proper /dev/shm which is not available in OBS -Patch04: OBS_dev-shm.patch -# # PATCH-FEATURE-UPSTREAM distutils-reproducible-compile.patch gh#python/cpython#8057 mcepl@suse.com # Improve reproduceability Patch06: distutils-reproducible-compile.patch @@ -156,9 +152,6 @@ Patch29: bpo-31046_ensurepip_honours_prefix.patch # PATCH-FIX-UPSTREAM bsc1167501-invalid-alignment.patch gh#python/cpython#19133 mcepl@suse.com # Fix wrong misalignment of pointer to vectorcallfunc Patch31: bsc1167501-invalid-alignment.patch -# PATCH-FIX-UPSTREAM bpo40784-Fix-sqlite3-deterministic-test.patch bpo#40784 Andreas.Stieger@gmx.de -# Fix tests with SQLite 3.32 -Patch32: bpo40784-Fix-sqlite3-deterministic-test.patch BuildRequires: automake BuildRequires: fdupes BuildRequires: gmp-devel @@ -400,7 +393,6 @@ other applications. %patch03 -p1 %endif -%patch04 -p1 %patch06 -p1 %patch07 -p1 %patch08 -p1 @@ -416,7 +408,6 @@ other applications. %patch28 -p1 %patch29 -p1 %patch31 -p1 -%patch32 -p1 # drop Autoconf version requirement sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac