@@ -46,7 +46,6 @@ use crate::pyobject::{
46
46
use crate :: scope:: Scope ;
47
47
use crate :: stdlib;
48
48
use crate :: sysmodule;
49
- use crossbeam_utils:: atomic:: AtomicCell ;
50
49
51
50
// use objects::objects;
52
51
@@ -65,14 +64,14 @@ pub struct VirtualMachine {
65
64
pub profile_func : RefCell < PyObjectRef > ,
66
65
pub trace_func : RefCell < PyObjectRef > ,
67
66
pub use_tracing : Cell < bool > ,
67
+ pub recursion_limit : Cell < usize > ,
68
68
pub signal_handlers : Option < RefCell < [ PyObjectRef ; NSIG ] > > ,
69
69
pub state : Arc < PyGlobalState > ,
70
70
pub initialized : bool ,
71
71
}
72
72
73
73
pub struct PyGlobalState {
74
74
pub settings : PySettings ,
75
- pub recursion_limit : AtomicCell < usize > ,
76
75
pub stdlib_inits : HashMap < String , stdlib:: StdlibInitFunc > ,
77
76
pub frozen : HashMap < String , bytecode:: FrozenModule > ,
78
77
}
@@ -199,10 +198,10 @@ impl VirtualMachine {
199
198
profile_func,
200
199
trace_func,
201
200
use_tracing : Cell :: new ( false ) ,
201
+ recursion_limit : Cell :: new ( if cfg ! ( debug_assertions) { 256 } else { 512 } ) ,
202
202
signal_handlers : Some ( signal_handlers) ,
203
203
state : Arc :: new ( PyGlobalState {
204
204
settings,
205
- recursion_limit : AtomicCell :: new ( if cfg ! ( debug_assertions) { 256 } else { 512 } ) ,
206
205
stdlib_inits,
207
206
frozen,
208
207
} ) ,
@@ -310,7 +309,7 @@ impl VirtualMachine {
310
309
}
311
310
312
311
fn check_recursive_call ( & self , _where : & str ) -> PyResult < ( ) > {
313
- if self . frames . borrow ( ) . len ( ) > self . state . recursion_limit . load ( ) {
312
+ if self . frames . borrow ( ) . len ( ) > self . recursion_limit . get ( ) {
314
313
Err ( self . new_recursion_error ( format ! ( "maximum recursion depth exceeded {}" , _where) ) )
315
314
} else {
316
315
Ok ( ( ) )
0 commit comments