Message7125
Hey Frank,
I did a little experiment in PyFunction. Wrapping the __call__ with recursion_depth check makes it obey the recursion limits, and it fixes Habib's problem (i guess because there's enough stack for classloader not to go mad). Now, this is a bit more code that every function call will use and will probably impact performance a bit (IMO, correctness first but I'll need to come up with a good benchmark to validate the performance difference). My biggest worry though is that stuff that worked before might not work. Without this code my system is able to recurse ~1600 times, but with the new check, it would do only 1000 times. Maybe we add it to 2.7 only and not 2.5...
One more thing. If someone sets a smaller java stack size, we would still hit this obscurish problem. Maybe we should change the exception message a bit so that it's at least a little more descriptive?
Let me know what you think?
@Override
public PyObject __call__(ThreadState state, PyObject arg0, PyObject arg1) {
if (state.recursion_depth++ > state.systemState.getrecursionlimit())
throw Py.RuntimeError("maximum recursion depth exceeded");
try {
return __code__.call(state, arg0, arg1, __globals__, func_defaults, func_closure);
} finally {
--state.recursion_depth;
}
} |
|
Date |
User |
Action |
Args |
2012-05-21 23:59:48 | darjus | set | messageid: <1337644788.08.0.18535763362.issue1883@psf.upfronthosting.co.za> |
2012-05-21 23:59:48 | darjus | set | recipients:
+ darjus, fwierzbicki, hnaderi |
2012-05-21 23:59:48 | darjus | link | issue1883 messages |
2012-05-21 23:59:47 | darjus | create | |
|