@@ -13,7 +13,8 @@ pub fn init(context: &PyContext) {
1313let ref frame_type = context. frame_type ;
1414 frame_type. set_attr ( "__new__" , context. new_rustfunc ( frame_new) ) ;
1515 frame_type. set_attr ( "__repr__" , context. new_rustfunc ( frame_repr) ) ;
16- frame_type. set_attr ( "f_locals" , context. new_property ( frame_locals) ) ;
16+ frame_type. set_attr ( "f_locals" , context. new_property ( frame_flocals) ) ;
17+ frame_type. set_attr ( "f_code" , context. new_property ( frame_fcode) ) ;
1718}
1819
1920fn frame_new ( vm : & mut VirtualMachine , args : PyFuncArgs ) ->PyResult {
@@ -27,7 +28,7 @@ fn frame_repr(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
2728Ok ( vm. new_str ( repr) )
2829}
2930
30- fn frame_locals ( vm : & mut VirtualMachine , args : PyFuncArgs ) ->PyResult {
31+ fn frame_flocals ( vm : & mut VirtualMachine , args : PyFuncArgs ) ->PyResult {
3132arg_check ! ( vm, args, required =[ ( frame, Some ( vm. ctx. frame_type( ) ) ) ] ) ;
3233let frame =get_value ( frame) ;
3334let py_scope = frame. locals . clone ( ) ;
@@ -40,6 +41,11 @@ fn frame_locals(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
4041}
4142}
4243
44+ fn frame_fcode ( vm : & mut VirtualMachine , args : PyFuncArgs ) ->PyResult {
45+ arg_check ! ( vm, args, required =[ ( frame, Some ( vm. ctx. frame_type( ) ) ) ] ) ;
46+ Ok ( vm. ctx . new_code_object ( get_value ( frame) . code ) )
47+ }
48+
4349pub fn get_value ( obj : & PyObjectRef ) ->Frame {
4450if let PyObjectKind :: Frame { frame} =& obj. borrow ( ) . kind {
4551 frame. clone ( )