summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-12 21:10:56 (GMT)
committerGitHub <noreply@github.com>2018-09-12 21:10:56 (GMT)
commitb608fcd444c00ff37a19d34e4eeadb1221fb6436 (patch)
tree5d8fbb63e4a3d1cc2b0fa1d57f714da70fbddab2
parent329ea4ef7cc3a907a64c6f0702fc93206b6744de (diff)
downloadcpython-b608fcd444c00ff37a19d34e4eeadb1221fb6436.zip
cpython-b608fcd444c00ff37a19d34e4eeadb1221fb6436.tar.gz
cpython-b608fcd444c00ff37a19d34e4eeadb1221fb6436.tar.bz2
closes bpo-34004: Skip lock interruption tests on musl. (GH-9224)
Returning EINTR from pthread semaphore or lock acquisition is an optional POSIX feature. musl does not provide this feature, so some threadsignal tests fail when Python is built against it. There's no good way to test for musl, so we skip if we're on Linux and not using glibc pthreads. Also, hedge in the threading documentation about when we can provide interrupts from lock acquisition. (cherry picked from commit 5b10d5111d7a855297654af9045f8907b7d3dd08) Co-authored-by: Benjamin Peterson <benjamin@python.org>
-rw-r--r--Doc/library/threading.rst3
-rw-r--r--Lib/test/test_threadsignals.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index b94021b..e6185c5 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -400,7 +400,8 @@ All methods are executed atomically.
The *timeout* parameter is new.
.. versionchanged:: 3.2
- Lock acquires can now be interrupted by signals on POSIX.
+ Lock acquisition can now be interrupted by signals on POSIX if the
+ underlying threading implementation supports it.
.. method:: release()
diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py
index 1ad6c63..7e13b17 100644
--- a/Lib/test/test_threadsignals.py
+++ b/Lib/test/test_threadsignals.py
@@ -78,6 +78,10 @@ class ThreadSignals(unittest.TestCase):
@unittest.skipIf(USING_PTHREAD_COND,
'POSIX condition variables cannot be interrupted')
+ @unittest.skipIf(sys.platform.startswith('linux') and
+ not sys.thread_info.version,
+ 'Issue 34004: musl does not allow interruption of locks '
+ 'by signals.')
# Issue #20564: sem_timedwait() cannot be interrupted on OpenBSD
@unittest.skipIf(sys.platform.startswith('openbsd'),
'lock cannot be interrupted on OpenBSD')
@@ -105,6 +109,10 @@ class ThreadSignals(unittest.TestCase):
@unittest.skipIf(USING_PTHREAD_COND,
'POSIX condition variables cannot be interrupted')
+ @unittest.skipIf(sys.platform.startswith('linux') and
+ not sys.thread_info.version,
+ 'Issue 34004: musl does not allow interruption of locks '
+ 'by signals.')
# Issue #20564: sem_timedwait() cannot be interrupted on OpenBSD
@unittest.skipIf(sys.platform.startswith('openbsd'),
'lock cannot be interrupted on OpenBSD')