Skip to content

Commit 8fa2f9d

Browse files
committed
Implement string streaming via sep. class
Allows json-stream's JsonStringReader unit tests to work for us, too.
1 parent 4c8cb3a commit 8fa2f9d

File tree

7 files changed

+729
-279
lines changed

7 files changed

+729
-279
lines changed

json_stream_rs_tokenizer/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"ExtensionException",
66
"ExtensionUnavailable",
77
"RequestedFeatureUnavailable",
8+
"JsonStringReader",
89
]
910

1011

@@ -20,6 +21,7 @@ class TokenType:
2021
from .json_stream_rs_tokenizer import (
2122
RustTokenizer as _RustTokenizer,
2223
supports_bigint as _supports_bigint,
24+
JsonStringReader,
2325
)
2426

2527
# included only for backwards-compatibility - to the outside world, bigint
@@ -90,7 +92,7 @@ def rust_tokenizer_or_raise(requires_bigint=True, **kwargs):
9092
ExtensionUnavailable: If the Rust extension is not available.
9193
RequestedFeatureUnavailable: If a requested feature is not available.
9294
"""
93-
supported_kwargs = {"buffering"}
95+
supported_kwargs = {"buffering", "strings_as_files"}
9496
unsupported = kwargs.keys() - supported_kwargs
9597
if unsupported:
9698
raise RequestedFeatureUnavailable(

src/int.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ pub enum ParseIntError {
1818
use num_bigint::BigInt;
1919

2020
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
21+
#[derive(Clone)]
2122
pub enum AppropriateInt {
2223
Normal(i64),
2324
Big(BigInt),
2425
}
2526

2627
#[cfg(all(any(Py_LIMITED_API, PyPy)))]
28+
#[derive(Clone)]
2729
pub enum AppropriateInt {
2830
Normal(i64),
2931
Big(String), // to be converted into int on the Python side

0 commit comments

Comments
 (0)