Author: Jean-Paul Calderone <[email protected]>
Branch: non-null-threadstate
Changeset: r53275:bfc2facb5e36
Date: 2012-03-08 14:41 -0800
http://bitbucket.org/pypy/pypy/changeset/bfc2facb5e36/
Log: Start trying to unit test PyEval_SaveThread, but mostly fail so far
diff --git a/pypy/module/cpyext/test/test_pystate.py
b/pypy/module/cpyext/test/test_pystate.py
--- a/pypy/module/cpyext/test/test_pystate.py
+++ b/pypy/module/cpyext/test/test_pystate.py
@@ -57,3 +57,13 @@
assert ref == api.PyThreadState_GetDict()
w_obj = from_ref(space, ref)
assert space.isinstance_w(w_obj, space.w_dict)
+
+ def test_savethread(self, space, api):
+ thread = api.PyImport_Import(space.wrap("thread"))
+ space.threadlocals.setup_threads(space)
+
+ ts = api.PyEval_SaveThread()
+ assert ts
+ assert api.PyThreadState_Get() == nullptr(PyThreadState.TO)
+ api.PyEval_RestoreThread(ts)
+ assert api.PyThreadState_Get() != nullptr(PyThreadState.TO)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit