Author: Manuel Jacob <[email protected]>
Branch: py3.3
Changeset: r76171:7dd999f6e56a
Date: 2015-02-27 12:34 +0100
http://bitbucket.org/pypy/pypy/changeset/7dd999f6e56a/
Log: Partially implement sys.thread_info by returning None (which means
unknown) for each field.
diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
--- a/pypy/module/sys/__init__.py
+++ b/pypy/module/sys/__init__.py
@@ -77,7 +77,8 @@
'float_info' : 'system.get_float_info(space)',
'int_info' : 'system.get_int_info(space)',
'hash_info' : 'system.get_hash_info(space)',
- 'float_repr_style' : 'system.get_float_repr_style(space)'
+ 'float_repr_style' : 'system.get_float_repr_style(space)',
+ 'thread_info' : 'system.get_thread_info(space)'
}
if sys.platform == 'win32':
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
@@ -37,6 +37,11 @@
inf = structseqfield(2)
nan = structseqfield(3)
imag = structseqfield(4)
+
+class thread_info(metaclass=structseqtype):
+ name = structseqfield(0)
+ lock = structseqfield(1)
+ version = structseqfield(2)
""")
@@ -80,3 +85,16 @@
def get_float_repr_style(space):
return space.wrap("short")
+
+def get_thread_info(space):
+ # TODO: implement this instead of returning None (which means unknown) for
+ # every field
+ if not space.config.objspace.usemodules.thread:
+ return None
+ info_w = [
+ space.wrap(space.w_None),
+ space.wrap(space.w_None),
+ space.wrap(space.w_None),
+ ]
+ w_thread_info = app.wget(space, "thread_info")
+ return space.call_function(w_thread_info, space.newtuple(info_w))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit