Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreamDeserializer errors on cut-off decimal numbers #524

Closed
17dec opened this issue Mar 15, 2019 · 1 comment
Closed

StreamDeserializer errors on cut-off decimal numbers #524

17dec opened this issue Mar 15, 2019 · 1 comment
Labels

Comments

@17dec
Copy link

17dec commented Mar 15, 2019

Simple example:

fn main() {
    dbg!(serde_json::Deserializer::from_slice(b"[1.").into_iter::<Vec<f64>>().next());
}

I'd expect that to return None or an EOF error - the array is not finished yet and the number is valid if it's followed by more digits. But instead it returns an early parse error:

serde_json::Deserializer::from_slice(b"[1.").into_iter::<Vec<f64>>().next() = Some(
    Err(
        Error("invalid number", line: 1, column: 3)
    )
)

(What I'm really doing is using a StreamDeserializer with a little bit of custom parsing to parse a large array of values, so my problem would also be solved with #404 )

@dtolnay dtolnay added the bug label Mar 16, 2019
@dtolnay
Copy link
Member

dtolnay commented Mar 16, 2019

Thanks, I would accept a PR to return an EOF error in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants