We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b0a942 commit 55f94bcCopy full SHA for 55f94bc
1 file changed
src/py_object_sort.rs
@@ -47,7 +47,7 @@ pub struct PyObjectSort {
47
impl Debug for PyObjectSort {
48
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
49
let hashable_to_index =
50
- Python::with_gil(|py| self.hashable_to_index.bind(py).str().unwrap().to_string());
+ Python::with_gil(|py| self.hashable_to_index.bind(py).str().map_or_else(|_| "<error>".to_string(), |s| s.to_string()));
51
f.debug_struct("PyObjectSort")
52
.field("objects", &self.objects)
53
.field("id_to_index", &self.id_to_index)
@@ -165,6 +165,7 @@ impl PyObjectSort {
165
fn __clear__<'py>(&mut self, py: Python<'py>) {
166
self.hashable_to_index.bind(py).clear();
167
self.objects.lock().unwrap().clear();
168
+ self.id_to_index.lock().unwrap().clear();
169
}
170
171
0 commit comments