Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r91864:3d878f5a314f
Date: 2017-07-13 14:30 +0200
http://bitbucket.org/pypy/pypy/changeset/3d878f5a314f/

Log:    Fix for Linux distributions on which os.confstr('CS_GNU_xxx')
        doesn't work

diff --git a/pypy/module/sys/system.py b/pypy/module/sys/system.py
--- a/pypy/module/sys/system.py
+++ b/pypy/module/sys/system.py
@@ -113,17 +113,19 @@
     if not space.config.objspace.usemodules.thread:
         return None
     from rpython.rlib import rthread
+    w_version = space.w_None
     if rthread.RPYTHREAD_NAME == "pthread":
         w_lock = space.newtext("semaphore" if rthread.USE_SEMAPHORES
                                else "mutex+cond")
         if rthread.CS_GNU_LIBPTHREAD_VERSION is not None:
-            w_version = space.newtext(
-                os.confstr(rthread.CS_GNU_LIBPTHREAD_VERSION))
-        else:
-            w_version = space.w_None
+            try:
+                name = os.confstr(rthread.CS_GNU_LIBPTHREAD_VERSION)
+            except OSError:
+                pass
+            else:
+                w_version = space.newtext(name)
     else:
         w_lock = space.w_None
-        w_version = space.w_None
     info_w = [
         space.newtext(rthread.RPYTHREAD_NAME),
         w_lock, w_version,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to