STINNER Victor added the comment:

> _Py_MakeEndRecCheck() was changed in issue5392 (noised Antoine as a 
> committer).

Oh, I didn't know this issue. If I am right, it's a duplicate of this issue, 
even if it was a little bit different because the lower-water mark was computed 
differently.

> There are many ways to make it monotonic.

Since I don't understand well this issue, I prefer to keep the formula 
unchanged for low limit (smaller than 100, or smaller than 200 with my patch) 
to keep the 3/4 ratio.

> Since the formula is so complex, it would be worth to extract common part 
> from _Py_MakeEndRecCheck() and sys_setrecursionlimit(). Otherwise the code 
> can become desynchronized.

Right, it's now done in my new patch.

> The error message still looks confusing to me. May be short it to "limit is 
> too low"? Noised David as grammar expert.

I prefer to really explain the fact that the RecursionError is raised depending 
on the current recursion depth. Otherwise, I'm quite sure that someone will 
complain that "too low" have different values on the same PC but on two 
different applications.

> Why not have an hardcoded minimum limit? Current recursion depth and 
> therefore minimal recursion limit are implementation defined and can depend 
> on a way how the module is executed (run a script, import a module, run with 
> runpy or IDLE, etc).

I'm not sure that you understood correctly the issue. The root cause is that 
you cannot call sys.setrecursionlimit(X) at recursion depth Y. There is no 
constant "minimum limit": it depends on the recusion depth because of how 
Python handles recursion error (the overflowed flag).

An alternative would be to remove completly the overflowed flag with its fatal 
error. It was introduced during large refactoring of Python, maybe the bug 
cannot occur anymore?

Again, since I don't know the whole history of how Python handles recursion 
error, I prefer the conservative approach of changing the minimum amount of 
code.

> May be interpret the limit relatively to current recursion depth?

Hum, I dislike this idea. I prefer to keep an absolute value. Otherwise, it 
would make Python more surprising.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25274>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to