Author: Armin Rigo <[email protected]>
Branch:
Changeset: r90238:fcfa989b8c49
Date: 2017-02-21 08:37 +0100
http://bitbucket.org/pypy/pypy/changeset/fcfa989b8c49/
Log: A test that fails before 8e04fbcbc608
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
@@ -173,6 +173,26 @@
res = module.bounce()
assert res == 4
+ def test_nested_pygilstate_ensure(self):
+ module = self.import_extension('foo', [
+ ("bounce", "METH_NOARGS",
+ """
+ PyGILState_STATE gilstate;
+ PyThreadState *tstate;
+ PyObject *dict;
+
+ if (PyEval_ThreadsInitialized() == 0)
+ PyEval_InitThreads();
+ dict = PyThreadState_GetDict();
+ gilstate = PyGILState_Ensure();
+ PyGILState_Release(gilstate);
+ if (PyThreadState_GetDict() != dict)
+ return PyLong_FromLong(-2);
+ return PyLong_FromLong(4);
+ """)])
+ res = module.bounce()
+ assert res == 4
+
def test_threadsinitialized(self):
module = self.import_extension('foo', [
("test", "METH_NOARGS",
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit