Skip to content

Commit 02d304d

Browse files
committed
update to PyO3 0.19.0
1 parent 0fe0936 commit 02d304d

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ include = [
2626
]
2727

2828
[dependencies]
29-
pyo3 = "0.18.2"
29+
pyo3 = "0.19.0"
3030
regex = "1.6.0"
3131
strum = { version = "0.24.1", features = ["derive"] }
3232
strum_macros = "0.24.3"
@@ -59,9 +59,9 @@ codegen-units = 1
5959
strip = true
6060

6161
[dev-dependencies]
62-
pyo3 = { version = "0.18.2", features = ["auto-initialize"] }
62+
pyo3 = { version = "0.19.0", features = ["auto-initialize"] }
6363

6464
[build-dependencies]
6565
version_check = "0.9.4"
6666
# used where logic has to be version/distribution specific, e.g. pypy
67-
pyo3-build-config = "0.18.2"
67+
pyo3-build-config = "0.19.0"

src/input/input_python.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ impl<'a> Input<'a> for PyAny {
153153
} else if let Ok(tuple) = self.downcast::<PyTuple>() {
154154
Ok(PyArgs::new(Some(tuple), None).into())
155155
} else if let Ok(list) = self.downcast::<PyList>() {
156-
let tuple = list_as_tuple(list);
157-
Ok(PyArgs::new(Some(tuple), None).into())
156+
Ok(PyArgs::new(Some(list.to_tuple()), None).into())
158157
} else {
159158
Err(ValError::new(ErrorType::ArgumentsType, self))
160159
}
@@ -296,7 +295,7 @@ impl<'a> Input<'a> for PyAny {
296295
}
297296

298297
fn ultra_strict_float(&self) -> ValResult<f64> {
299-
if matches!(self.is_instance_of::<PyInt>(), Ok(true)) {
298+
if self.is_instance_of::<PyInt>() {
300299
Err(ValError::new(ErrorType::FloatType, self))
301300
} else if let Ok(float) = self.extract::<f64>() {
302301
Ok(float)
@@ -695,12 +694,3 @@ fn is_dict_items_type(v: &PyAny) -> bool {
695694
.as_ref(py);
696695
v.is_instance(items_type).unwrap_or(false)
697696
}
698-
699-
pub fn list_as_tuple(list: &PyList) -> &PyTuple {
700-
let py_tuple: Py<PyTuple> = unsafe {
701-
let ptr = list.as_ptr();
702-
let tuple_ptr = ffi::PyList_AsTuple(ptr);
703-
Py::from_owned_ptr(list.py(), tuple_ptr)
704-
};
705-
py_tuple.into_ref(list.py())
706-
}

src/serializers/type_serializers/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fn on_error(py: Python, err: PyErr, function_name: &str, extra: &Extra) -> PyRes
189189
}
190190
} else if let Ok(err) = exception.extract::<PydanticSerializationError>() {
191191
py_err!(PydanticSerializationError; "{}", err)
192-
} else if exception.is_instance_of::<PyRecursionError>().unwrap_or(false) {
192+
} else if exception.is_instance_of::<PyRecursionError>() {
193193
py_err!(PydanticSerializationError; "Error calling function `{}`: RecursionError", function_name)
194194
} else {
195195
let new_err = py_error_type!(PydanticSerializationError; "Error calling function `{}`: {}", function_name, err);

0 commit comments

Comments
 (0)