File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -925,15 +925,15 @@ impl ExecutingFrame<'_> {
925925 _ => None ,
926926 } ;
927927
928- let exit = self . pop_value ( ) ;
928+ let exit = self . top_value ( ) ;
929929
930930 let args = if let Some ( exc) = exc {
931931 vm. split_exception ( exc)
932932 } else {
933933 ( vm. ctx . none ( ) , vm. ctx . none ( ) , vm. ctx . none ( ) )
934934 } ;
935935 let exit_res = exit. call ( args, vm) ?;
936- self . push_value ( exit_res) ;
936+ self . replace_top ( exit_res) ;
937937
938938 Ok ( None )
939939 }
@@ -1955,6 +1955,13 @@ impl ExecutingFrame<'_> {
19551955 self . state . stack . drain ( stack_len - count..)
19561956 }
19571957
1958+ #[ inline]
1959+ fn replace_top ( & mut self , mut top : PyObjectRef ) -> PyObjectRef {
1960+ let last = self . state . stack . last_mut ( ) . unwrap ( ) ;
1961+ std:: mem:: swap ( & mut top, last) ;
1962+ top
1963+ }
1964+
19581965 #[ inline]
19591966 #[ track_caller] // not a real track_caller but top_value is not very useful
19601967 fn top_value ( & self ) -> & PyObject {
You can’t perform that action at this time.
0 commit comments