File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -479,7 +479,7 @@ mod sys {
479
479
} ) ?;
480
480
let recursion_depth = vm. current_recursion_depth ( ) ;
481
481
482
- if recursion_limit > recursion_depth + 1 {
482
+ if recursion_limit > recursion_depth {
483
483
vm. recursion_limit . set ( recursion_limit) ;
484
484
Ok ( ( ) )
485
485
} else {
Original file line number Diff line number Diff line change @@ -538,8 +538,9 @@ impl VirtualMachine {
538
538
self . with_frame ( frame, |f| f. run ( self ) )
539
539
}
540
540
541
+ // To be called right before raising the recursion depth.
541
542
fn check_recursive_call ( & self , _where : & str ) -> PyResult < ( ) > {
542
- if self . recursion_depth . get ( ) > self . recursion_limit . get ( ) {
543
+ if self . recursion_depth . get ( ) >= self . recursion_limit . get ( ) {
543
544
Err ( self . new_recursion_error ( format ! ( "maximum recursion depth exceeded {}" , _where) ) )
544
545
} else {
545
546
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments