Option to enable recursion checks?

12 views
Skip to first unread message

John Ehresman

unread,
Aug 4, 2021, 11:15:55 AM8/4/21
to cython-users
Is there an option in Cython to enable recursion checks and to raise an exception when a limit is reached like the Python interpreter does? I realize there is some runtime cost in doing this and that code shouldn’t depend on the exception, but I’d rather get an exception than a core dump when things go wrong.

Thanks,

John

D Woods

unread,
Aug 5, 2021, 10:10:58 AM8/5/21
to cython-users
I don't think there is an option. Cython seems to generate Py_EnterRecursiveCall only in a limited number of places (specifically when calling Python objects).

It probably wouldn't be too hard to add it as an option (it'd get generated alongside the "refnanny" code that gets generated at the start/end of every function), but I don't know that anyone has immediate plans to do it (i.e. if you want it then you may have to write it yourself!).

I'm sure I remember seeing a github issue about this in the past, but I can't find it now.

John Ehresman

unread,
Aug 6, 2021, 6:50:20 PM8/6/21
to cython-users
Thanks. I’m working on adding it as an option.

John
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "cython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/cython-users/151d3e29-af8d-4b6a-82e4-1af85427907fn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages