Skip to content

Instantly share code, notes, and snippets.

@akaptur
Created September 29, 2014 19:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akaptur/d8348c21e93d61ec9397 to your computer and use it in GitHub Desktop.
Save akaptur/d8348c21e93d61ec9397 to your computer and use it in GitHub Desktop.
recursion limit checker
# 2.7
if (tstate->recursion_depth > recursion_limit) {
--tstate->recursion_depth;
PyErr_Format(PyExc_RuntimeError,
"maximum recursion depth exceeded%s",
where);
return -1;
# 3.4
if (tstate->recursion_depth > recursion_limit) {
--tstate->recursion_depth;
tstate->overflowed = 1;
PyErr_Format(PyExc_RuntimeError,
"maximum recursion depth exceeded%s",
where);
return -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment