Skip to content

Commit 3f74daf

Browse files
committed
Faster setattr
1 parent b4189ab commit 3f74daf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

vm/src/obj/objframe.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use super::objcode::PyCodeRef;
66
use super::objdict::PyDictRef;
7+
use super::objstr::PyStringRef;
78
use crate::frame::FrameRef;
89
use crate::pyobject::{IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyResult};
910
use crate::vm::VirtualMachine;
@@ -25,10 +26,9 @@ impl FrameRef {
2526
}
2627

2728
#[pymethod(name = "__delattr__")]
28-
fn delattr(self, value: PyObjectRef, vm: &VirtualMachine) {
29-
println!("Called: FrameRef::f_trace over {:?}", value);
30-
let value_str = vm.to_str(&value).unwrap().to_string();
31-
if value_str == "f_trace" {
29+
fn delattr(self, value: PyStringRef, vm: &VirtualMachine) {
30+
println!("Called: FrameRef::delattr over {:?}", value);
31+
if value.to_string() == "f_trace" {
3232
self.set_f_trace(vm.get_none());
3333
};
3434
}
@@ -74,7 +74,7 @@ impl FrameRef {
7474
}
7575

7676
#[pyproperty]
77-
fn f_lineno(self) -> usize {
77+
pub fn f_lineno(self) -> usize {
7878
self.current_location().row()
7979
}
8080

0 commit comments

Comments
 (0)