Skip to content

Commit

Permalink
Fixes for python.
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia committed Nov 3, 2023
1 parent fce2436 commit b429c88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions td-rs-base/src/py.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl ToPyObj for f32 {

impl CheckPyObj for f32 {
unsafe fn check_py_obj(obj: *mut pyo3_ffi::PyObject) -> bool {
pyo3_ffi::PyFloat_Check(obj) != 0
pyo3_ffi::PyFloat_Check(obj) != 0 || pyo3_ffi::PyLong_Check(obj) != 0
}
}

Expand All @@ -231,7 +231,7 @@ impl ToPyObj for f64 {

impl CheckPyObj for f64 {
unsafe fn check_py_obj(obj: *mut pyo3_ffi::PyObject) -> bool {
pyo3_ffi::PyFloat_Check(obj) != 0
pyo3_ffi::PyFloat_Check(obj) != 0 || pyo3_ffi::PyLong_Check(obj) != 0
}
}

Expand Down
1 change: 1 addition & 0 deletions td-rs-derive-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ fn impl_py_op(input: &DeriveInput) -> TokenStream {
.as_ptr()
.cast::<std::os::raw::c_char>(),
);
return -1;
}

let value = FromPyObj::from_py_obj(value);
Expand Down

0 comments on commit b429c88

Please sign in to comment.