Skip to content

Commit 747950a

Browse files
committed
build against PyO3 0.27 draft
1 parent 03f8909 commit 747950a

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ debug = true
2727
[workspace.dependencies]
2828
pyo3 = { version = "0.26" }
2929
pyo3-build-config = { version = "0.26" }
30+
31+
[patch.crates-io]
32+
pyo3 = { git = "https://github.com/pyo3/pyo3.git" }
33+
pyo3-build-config = { git = "https://github.com/pyo3/pyo3.git" }

crates/jiter/src/py_lossless_float.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ impl Default for FloatMode {
2020

2121
const FLOAT_ERROR: &str = "Invalid float mode, should be `'float'`, `'decimal'` or `'lossless-float'`";
2222

23-
impl<'py> FromPyObject<'py> for FloatMode {
24-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
23+
impl<'py> FromPyObject<'_, 'py> for FloatMode {
24+
type Error = PyErr;
25+
26+
fn extract(ob: Borrowed<'_, 'py, PyAny>) -> PyResult<Self> {
2527
if let Ok(str_mode) = ob.extract::<&str>() {
2628
match str_mode {
2729
"float" => Ok(Self::Float),

crates/jiter/src/py_string_cache.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ impl Default for StringCacheMode {
2020
}
2121
}
2222

23-
impl<'py> FromPyObject<'py> for StringCacheMode {
24-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<StringCacheMode> {
23+
impl<'py> FromPyObject<'_, 'py> for StringCacheMode {
24+
type Error = PyErr;
25+
26+
fn extract(ob: Borrowed<'_, 'py, PyAny>) -> PyResult<StringCacheMode> {
2527
if let Ok(bool_mode) = ob.cast::<PyBool>() {
2628
Ok(bool_mode.is_true().into())
2729
} else if let Ok(str_mode) = ob.extract::<&str>() {

crates/jiter/src/python.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl PythonParse {
4343
///
4444
/// # Returns
4545
///
46-
/// A [PyObject](https://docs.rs/pyo3/latest/pyo3/type.PyObject.html) representing the parsed JSON value.
46+
/// A [Py<PyAny>>](https://docs.rs/pyo3/latest/pyo3/typePy<PyAny>y>.html) representing the parsed JSON value.
4747
pub fn python_parse<'py>(&self, py: Python<'py>, json_data: &[u8]) -> JsonResult<Bound<'py, PyAny>> {
4848
macro_rules! ppp {
4949
($string_cache:ident, $key_check:ident, $parse_number:ident) => {
@@ -237,8 +237,10 @@ impl<StringCache: StringMaybeCache, KeyCheck: MaybeKeyCheck, ParseNumber: MaybeP
237237

238238
const PARTIAL_ERROR: &str = "Invalid partial mode, should be `'off'`, `'on'`, `'trailing-strings'` or a `bool`";
239239

240-
impl<'py> FromPyObject<'py> for PartialMode {
241-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
240+
impl<'py> FromPyObject<'_, 'py> for PartialMode {
241+
type Error = PyErr;
242+
243+
fn extract(ob: Borrowed<'_, 'py, PyAny>) -> PyResult<Self> {
242244
if let Ok(bool_mode) = ob.cast::<PyBool>() {
243245
Ok(bool_mode.is_true().into())
244246
} else if let Ok(str_mode) = ob.extract::<&str>() {

0 commit comments

Comments
 (0)