mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Not expecting multiple simultaneous reads for a given frame
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::fmt;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Mutex, RwLock};
|
||||
use std::sync::Mutex;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
@@ -93,7 +93,7 @@ pub struct Frame {
|
||||
/// index of last instruction ran
|
||||
pub lasti: AtomicUsize,
|
||||
/// marker to know if this frame is being traced
|
||||
pub trace: RwLock<PyObjectRef>,
|
||||
pub trace: Mutex<PyObjectRef>,
|
||||
state: Mutex<FrameState>,
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ impl Frame {
|
||||
stack: Vec::new(),
|
||||
blocks: Vec::new(),
|
||||
}),
|
||||
trace: RwLock::new(vm.get_none()),
|
||||
trace: Mutex::new(vm.get_none()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,13 +71,13 @@ impl FrameRef {
|
||||
|
||||
#[pyproperty]
|
||||
fn f_trace(self) -> PyObjectRef {
|
||||
let boxed = self.trace.read();
|
||||
let boxed = self.trace.lock();
|
||||
boxed.unwrap().clone()
|
||||
}
|
||||
|
||||
#[pyproperty(setter)]
|
||||
fn set_f_trace(self, value: PyObjectRef) {
|
||||
let mut storage = self.trace.write().unwrap();
|
||||
let mut storage = self.trace.lock().unwrap();
|
||||
*storage = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user