Skip to content

Commit d9ebeef

Browse files
committed
optimize dict set_item
1 parent 1d1f4b1 commit d9ebeef

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ fn decode_dag_cbor_to_pyobject<R: Read + Seek>(
179179
prev_key = Some(key);
180180

181181
let value_py = decode_dag_cbor_to_pyobject(py, r, depth + 1)?;
182-
dict.set_item(key_py, value_py)?;
182+
// dict.set_item(key_py, value_py)?;
183+
// TODO(MarshalX): add error check
184+
unsafe {
185+
ffi::PyDict_SetItem(dict.as_ptr(), key_py.as_ptr(), value_py.as_ptr());
186+
}
183187
}
184188

185189
dict.into_pyobject(py)?.into()

0 commit comments

Comments
 (0)