Skip to content

Commit bbbdcbc

Browse files
committed
try new jiter LazyIndexMap implementation
1 parent ba8eab4 commit bbbdcbc

File tree

5 files changed

+50
-36
lines changed

5 files changed

+50
-36
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ base64 = "0.22.1"
4646
num-bigint = "0.4.6"
4747
python3-dll-a = "0.2.10"
4848
uuid = "1.10.0"
49-
jiter = { version = "0.5", features = ["python"] }
49+
jiter = { git = "https://github.com/pydantic/jiter", branch = "invariant-lifetimes", features = ["python"] }
5050
hex = "0.4.3"
5151

5252
[lib]

src/input/input_json.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::borrow::Cow;
33
use jiter::{JsonArray, JsonObject, JsonValue, LazyIndexMap};
44
use pyo3::prelude::*;
55
use pyo3::types::{PyDict, PyList, PyString};
6-
use smallvec::SmallVec;
76
use speedate::MicrosecondsPrecisionOverflowBehavior;
87
use strum::EnumMessage;
98

@@ -522,7 +521,7 @@ impl<'a, 'py, 'data> ValidatedList<'py> for &'a JsonArray<'data> {
522521
type Item = &'a JsonValue<'data>;
523522

524523
fn len(&self) -> Option<usize> {
525-
Some(SmallVec::len(self))
524+
Some((**self).len())
526525
}
527526
fn iterate<R>(self, consumer: impl ConsumeIterator<PyResult<Self::Item>, Output = R>) -> ValResult<R> {
528527
Ok(consumer.consume_iterator(self.iter().map(Ok)))
@@ -536,7 +535,7 @@ impl<'a, 'data> ValidatedTuple<'_> for &'a JsonArray<'data> {
536535
type Item = &'a JsonValue<'data>;
537536

538537
fn len(&self) -> Option<usize> {
539-
Some(SmallVec::len(self))
538+
Some((**self).len())
540539
}
541540
fn iterate<R>(self, consumer: impl ConsumeIterator<PyResult<Self::Item>, Output = R>) -> ValResult<R> {
542541
Ok(consumer.consume_iterator(self.iter().map(Ok)))

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn from_json<'py>(
6161
cache_mode: cache_strings,
6262
partial_mode: allow_partial,
6363
catch_duplicate_keys: false,
64-
lossless_floats: false,
64+
float_mode: jiter::FloatMode::Float,
6565
};
6666
parse_builder
6767
.python_parse(py, json_bytes)

src/validators/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Validator for JsonValidator {
7171
cache_mode: state.cache_str(),
7272
partial_mode: PartialMode::Off,
7373
catch_duplicate_keys: false,
74-
lossless_floats: false,
74+
float_mode: jiter::FloatMode::Float,
7575
};
7676
let obj = parse_builder
7777
.python_parse(py, json_bytes)

0 commit comments

Comments
 (0)