Skip to content

Commit 31ca3c9

Browse files
committed
updates for new jiter
1 parent a968d35 commit 31ca3c9

File tree

4 files changed

+23
-53
lines changed

4 files changed

+23
-53
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include = [
2727
rust-version = "1.70"
2828

2929
[dependencies]
30-
pyo3 = { version = "0.20.3", features = ["generate-import-lib", "num-bigint"] }
30+
pyo3 = { version = "0.21.0-beta.0", features = ["generate-import-lib", "num-bigint"] }
3131
regex = "1.10.3"
3232
strum = { version = "0.25.0", features = ["derive"] }
3333
strum_macros = "0.26.1"
@@ -44,7 +44,7 @@ base64 = "0.21.7"
4444
num-bigint = "0.4.4"
4545
python3-dll-a = "0.2.7"
4646
uuid = "1.7.0"
47-
jiter = {version = "0.0.6", features = ["python"]}
47+
jiter = { git = "https://github.com/pydantic/jiter", branch = "dh/py2", version = "0.0.6", features = ["python"]}
4848

4949
[lib]
5050
name = "_pydantic_core"
@@ -71,12 +71,12 @@ debug = true
7171
strip = false
7272

7373
[dev-dependencies]
74-
pyo3 = { version = "0.20.3", features = ["auto-initialize"] }
74+
pyo3 = { version = "0.21.0-beta.0", features = ["auto-initialize"] }
7575

7676
[build-dependencies]
7777
version_check = "0.9.4"
7878
# used where logic has to be version/distribution specific, e.g. pypy
79-
pyo3-build-config = { version = "0.20.2" }
79+
pyo3-build-config = { version = "0.21.0-beta.0" }
8080

8181
[lints.clippy]
8282
dbg_macro = "warn"

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ pub use validators::{validate_core_schema, PySome, SchemaValidator};
3939
use crate::input::Input;
4040

4141
#[pyfunction(signature = (data, *, allow_inf_nan=true, cache_strings=true))]
42-
pub fn from_json(py: Python, data: &PyAny, allow_inf_nan: bool, cache_strings: bool) -> PyResult<PyObject> {
42+
pub fn from_json<'py>(
43+
py: Python<'py>,
44+
data: &PyAny,
45+
allow_inf_nan: bool,
46+
cache_strings: bool,
47+
) -> PyResult<Py2<'py, PyAny>> {
4348
let v_match = data
4449
.validate_bytes(false)
4550
.map_err(|_| PyTypeError::new_err("Expected bytes, bytearray or str"))?;

src/validators/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl Validator for JsonValidator {
6666
None => {
6767
let obj =
6868
jiter::python_parse(py, json_bytes, true, true).map_err(|e| map_json_err(input, e, json_bytes))?;
69-
Ok(obj)
69+
Ok(obj.into())
7070
}
7171
}
7272
}

0 commit comments

Comments
 (0)