Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r93614:05955e010535
Date: 2018-01-03 19:04 +0100
http://bitbucket.org/pypy/pypy/changeset/05955e010535/

Log:    Invent a dummy thread id, if we ask for one during translation and
        we're running a host with no threads

diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -106,14 +106,20 @@
     if we_are_translated():
         return tlfield_thread_ident.getraw()
     else:
-        import thread
+        try:
+            import thread
+        except ImportError:
+            return 42
         return thread.get_ident()
 
 def get_or_make_ident():
     if we_are_translated():
         return tlfield_thread_ident.get_or_make_raw()
     else:
-        import thread
+        try:
+            import thread
+        except ImportError:
+            return 42
         return thread.get_ident()
 
 @specialize.arg(0)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to