Working `del frame.f_trace` as `frame.f_trace = None
This is the CPython behavior expected by bdb.py debugger.
Had not understood how does it work on CPython. Here has
implemented via frame.__delattr__ specially for f_trace.
Other `del frame.*` are actually noops for now
@@ -24,6 +24,15 @@ impl FrameRef {
"<frame object at .. >".to_owned()
}
+ #[pymethod(name = "__delattr__")]
+ fn delattr(self, value: PyObjectRef, vm: &VirtualMachine) {
+ println!("Called: FrameRef::f_trace over {:?}", value);
+ let value_str = vm.to_str(&value).unwrap().to_string();
+ if value_str == "f_trace" {
+ self.set_f_trace(vm.get_none());
+ };
+ }
+
#[pymethod]
fn clear(self) {
// TODO
