@@ -12,6 +12,7 @@ use crate::{
1212 coroutine:: Coro ,
1313 exceptions:: ExceptionCtor ,
1414 function:: { ArgMapping , Either , FuncArgs } ,
15+ object:: { Traverse , TraverseFn } ,
1516 protocol:: { PyIter , PyIterReturn } ,
1617 scope:: Scope ,
1718 stdlib:: { builtins, typing} ,
@@ -65,7 +66,7 @@ type Lasti = atomic::AtomicU32;
6566#[ cfg( not( feature = "threading" ) ) ]
6667type Lasti = core:: cell:: Cell < u32 > ;
6768
68- #[ pyclass( module = false , name = "frame" ) ]
69+ #[ pyclass( module = false , name = "frame" , traverse = "manual" ) ]
6970pub struct Frame {
7071 pub code : PyRef < PyCode > ,
7172 pub func_obj : Option < PyObjectRef > ,
@@ -96,6 +97,27 @@ impl PyPayload for Frame {
9697 }
9798}
9899
100+ unsafe impl Traverse for FrameState {
101+ fn traverse ( & self , tracer_fn : & mut TraverseFn < ' _ > ) {
102+ self . stack . traverse ( tracer_fn) ;
103+ }
104+ }
105+
106+ unsafe impl Traverse for Frame {
107+ fn traverse ( & self , tracer_fn : & mut TraverseFn < ' _ > ) {
108+ self . code . traverse ( tracer_fn) ;
109+ self . func_obj . traverse ( tracer_fn) ;
110+ self . fastlocals . traverse ( tracer_fn) ;
111+ self . cells_frees . traverse ( tracer_fn) ;
112+ self . locals . traverse ( tracer_fn) ;
113+ self . globals . traverse ( tracer_fn) ;
114+ self . builtins . traverse ( tracer_fn) ;
115+ self . trace . traverse ( tracer_fn) ;
116+ self . state . traverse ( tracer_fn) ;
117+ self . temporary_refs . traverse ( tracer_fn) ;
118+ }
119+ }
120+
99121// Running a frame can result in one of the below:
100122pub enum ExecutionResult {
101123 Return ( PyObjectRef ) ,
0 commit comments