[pypy-commit] pypy default: Invent a dummy thread id, if we ask for one during translation
arigo
pypy.commits at gmail.com
Wed Jan 3 13:05:20 EST 2018
Author: Armin Rigo <arigo at tunes.org>
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)
More information about the pypy-commit
mailing list