Skip to content

Commit 605e883

Browse files
committed
updates for new jiter
1 parent 0123a83 commit 605e883

File tree

4 files changed

+31
-58
lines changed

4 files changed

+31
-58
lines changed

Cargo.lock

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

Cargo.toml

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

2828
[dependencies]
29-
pyo3 = { version = "0.20.2", features = ["generate-import-lib", "num-bigint"] }
29+
pyo3 = { git = "https://github.com/davidhewitt/pyo3", branch="complete-py2", version = "0.21.0-dev", default-features=false, features = ["macros", "generate-import-lib", "num-bigint"] }
3030
regex = "1.10.2"
3131
strum = { version = "0.25.0", features = ["derive"] }
3232
strum_macros = "0.25.3"
@@ -43,7 +43,7 @@ base64 = "0.21.7"
4343
num-bigint = "0.4.4"
4444
python3-dll-a = "0.2.7"
4545
uuid = "1.6.1"
46-
jiter = {version = "0.0.6", features = ["python"]}
46+
jiter = { git = "https://github.com/pydantic/jiter", branch = "dh/py2", version = "0.0.6", features = ["python"]}
4747

4848
[lib]
4949
name = "_pydantic_core"
@@ -70,12 +70,12 @@ debug = true
7070
strip = false
7171

7272
[dev-dependencies]
73-
pyo3 = { version = "0.20.2", features = ["auto-initialize"] }
73+
pyo3 = { git = "https://github.com/davidhewitt/pyo3", branch="complete-py2", version = "0.21.0-dev", default-features=false, features = ["auto-initialize"] }
7474

7575
[build-dependencies]
7676
version_check = "0.9.4"
7777
# used where logic has to be version/distribution specific, e.g. pypy
78-
pyo3-build-config = { version = "0.20.2" }
78+
pyo3-build-config = { git = "https://github.com/davidhewitt/pyo3", branch="complete-py2", version = "0.21.0-dev" }
7979

8080
[lints.clippy]
8181
dbg_macro = "warn"
@@ -107,3 +107,10 @@ too_many_lines = "allow"
107107
unnecessary_wraps = "allow"
108108
unused_self = "allow"
109109
used_underscore_binding = "allow"
110+
111+
[patch.'https://github.com/davidhewitt/pyo3']
112+
pyo3 = { path = "../pyo3" }
113+
pyo3-build-config = { path = "../pyo3/pyo3-build-config" }
114+
115+
[patch.'https://github.com/pydantic/jiter']
116+
jiter = { path = "../jiter" }

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)