Skip to content

Commit 90b27a1

Browse files
committed
fix performance issue
1 parent 7767ad5 commit 90b27a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/input/input_python.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,11 @@ impl<'py> Input<'py> for Bound<'py, PyAny> {
434434
}
435435

436436
fn lax_dict<'a>(&'a self) -> ValResult<GenericPyMapping<'a, 'py>> {
437-
if let Ok(mapping) = self.downcast::<PyMapping>() {
437+
if check_if_ordered_dict(self) {
438+
Ok(GenericPyMapping::Mapping(self.downcast::<PyMapping>()?))
439+
} else if let Ok(dict) = self.downcast::<PyDict>() {
440+
Ok(GenericPyMapping::Dict(dict))
441+
} else if let Ok(mapping) = self.downcast::<PyMapping>() {
438442
Ok(GenericPyMapping::Mapping(mapping))
439443
} else {
440444
Err(ValError::new(ErrorTypeDefaults::DictType, self))

0 commit comments

Comments
 (0)