summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-19 21:58:51 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-19 21:58:51 (GMT)
commit754851f456d0b97c86f2d700e032632323840e29 (patch)
tree366726362ecd8a4849b9fc402eddf6fb2acbf9a5 /Lib/test/test_os.py
parentcf2a807831ee93ef39e73fcc682894b0695b6143 (diff)
downloadcpython-754851f456d0b97c86f2d700e032632323840e29.zip
cpython-754851f456d0b97c86f2d700e032632323840e29.tar.gz
cpython-754851f456d0b97c86f2d700e032632323840e29.tar.bz2
Issue #11223: Add threading._info() function providing informations about the
thread implementation. Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of test_threadsignals if a thread lock is implemented using a POSIX mutex and a POSIX condition variable. A POSIX condition variable cannot be interrupted by a signal (e.g. on Linux, the futex system call is restarted).
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 35aa7fa..5432412 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -27,12 +27,15 @@ except ImportError:
# and unmaintained) linuxthreads threading library. There's an issue
# when combining linuxthreads with a failed execv call: see
# http://bugs.python.org/issue4970.
-if (hasattr(os, "confstr_names") and
- "CS_GNU_LIBPTHREAD_VERSION" in os.confstr_names):
- libpthread = os.confstr("CS_GNU_LIBPTHREAD_VERSION")
- USING_LINUXTHREADS= libpthread.startswith("linuxthreads")
-else:
- USING_LINUXTHREADS= False
+USING_LINUXTHREADS = False
+if threading:
+ info = threading._info()
+ try:
+ pthread_version = info['pthread_version']
+ except KeyError:
+ pass
+ else:
+ USING_LINUXTHREADS = pthread_version.startswith("linuxthreads")
# Tests creating TESTFN
class FileTests(unittest.TestCase):