]> granicus.if.org Git - python/commitdiff
closes bpo-34004: Skip lock interruption tests on musl. (GH-9224)
authorBenjamin Peterson <benjamin@python.org>
Wed, 12 Sep 2018 20:48:03 +0000 (13:48 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Sep 2018 20:48:03 +0000 (13:48 -0700)
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.

Doc/library/threading.rst
Lib/test/test_threadsignals.py

index b94021b4eb8f89878a068314cd7163c1a929d89d..e6185c5b3a214c7c7e94fc37c10deeeacb9dbc2b 100644 (file)
@@ -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()
index 1ad6c63fea2e35453d905f8dd6ae714f2107b769..7e13b1720f91e9b890fe3e3df8295d0084b432fd 100644 (file)
@@ -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')