From 90eed4a1f23d801ac2c07cd8f1c89bbd5dfb502f Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Thu, 3 Jan 2019 17:10:45 +0000 Subject: [PATCH 1/3] Fix test error introduced by bpo-35189 --- Lib/test/eintrdata/eintr_tester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index 25c169bde5005f5..6aa902564b73514 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -507,7 +507,7 @@ def _lock(self, lock_func, lock_name): lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB) lock_func(f, fcntl.LOCK_UN) time.sleep(0.01) - except BlockingIOError: + except (BlockingIOError, PermissionError): break # the child locked the file just a moment ago for 'sleep_time' seconds # that means that the lock below will block for 'sleep_time' minus some From 20d9d5a8d81549d0f989eab36a25f1d7a5309e74 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Tue, 8 Jan 2019 22:11:31 +0000 Subject: [PATCH 2/3] Add NEWS blurb --- Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst diff --git a/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst b/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst new file mode 100644 index 000000000000000..8ad7bd2475c0be0 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst @@ -0,0 +1,2 @@ +Add PermissionError to the Exception: list +patch by Michael Felt, aixtools From cc1bc1dde8219ecae0ed541631f41e56f5135de7 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Mon, 21 Jan 2019 12:26:15 +0000 Subject: [PATCH 3/3] Skip the lockf() test for AIX rather than ignoring PermissionError on all platforms. --- Lib/test/eintrdata/eintr_tester.py | 6 +++++- .../next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index 6aa902564b73514..5f956b548fc40aa 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -12,6 +12,7 @@ import faulthandler import fcntl import os +import platform import select import signal import socket @@ -507,7 +508,7 @@ def _lock(self, lock_func, lock_name): lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB) lock_func(f, fcntl.LOCK_UN) time.sleep(0.01) - except (BlockingIOError, PermissionError): + except BlockingIOError: break # the child locked the file just a moment ago for 'sleep_time' seconds # that means that the lock below will block for 'sleep_time' minus some @@ -518,6 +519,9 @@ def _lock(self, lock_func, lock_name): self.stop_alarm() proc.wait() + # Issue 35633: See https://bugs.python.org/issue35633#msg333662 + # skip test rather than accept PermissionError from all platforms + @unittest.skipIf(platform.system() == "AIX", "AIX returns PermissionError") def test_lockf(self): self._lock(fcntl.lockf, "lockf") diff --git a/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst b/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst deleted file mode 100644 index 8ad7bd2475c0be0..000000000000000 --- a/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add PermissionError to the Exception: list -patch by Michael Felt, aixtools