[pypy-commit] pypy py3.5: Py_EnterRecursiveCall now raises RecursionError instead of generic RuntimeError (changed in 3.5)
rlamy
pypy.commits at gmail.com
Fri Jul 7 10:19:16 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r91786:28fa40558660
Date: 2017-07-07 15:18 +0100
http://bitbucket.org/pypy/pypy/changeset/28fa40558660/
Log: Py_EnterRecursiveCall now raises RecursionError instead of generic
RuntimeError (changed in 3.5)
diff --git a/pypy/module/cpyext/eval.py b/pypy/module/cpyext/eval.py
--- a/pypy/module/cpyext/eval.py
+++ b/pypy/module/cpyext/eval.py
@@ -261,12 +261,12 @@
global limit
limit += 1
if limit > 10:
- raise oefmt(space.w_RuntimeError,
+ raise oefmt(space.w_RecursionError,
"maximum recursion depth exceeded%s", rffi.charp2str(where))
return 0
from rpython.rlib.rstack import stack_almost_full
if stack_almost_full():
- raise oefmt(space.w_RuntimeError,
+ raise oefmt(space.w_RecursionError,
"maximum recursion depth exceeded%s", rffi.charp2str(where))
return 0
diff --git a/pypy/module/cpyext/test/test_eval.py b/pypy/module/cpyext/test/test_eval.py
--- a/pypy/module/cpyext/test/test_eval.py
+++ b/pypy/module/cpyext/test/test_eval.py
@@ -360,9 +360,5 @@
return PyLong_FromLong(res);
"""),], prologue= ''' int recurse(void); '''
)
- try:
- res = module.call_recursive()
- except RuntimeError as e:
- assert 'while calling recurse' in str(e)
- else:
- assert False, "expected RuntimeError"
+ excinfo = raises(RecursionError, module.call_recursive)
+ assert 'while calling recurse' in str(excinfo.value)
More information about the pypy-commit
mailing list