File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ resolver = "2"
44
55[workspace .package ]
66authors = [" Samuel Colvin <samuel@pydantic.dev>" ]
7- version = " 0.12 .0"
7+ version = " 0.13 .0"
88edition = " 2021"
99license = " MIT"
1010keywords = [" JSON" , " parsing" , " deserialization" , " iter" ]
1111categories = [" parser-implementations" , " parsing" ]
1212homepage = " https://github.com/pydantic/jiter/"
1313repository = " https://github.com/pydantic/jiter/"
1414# MSRV should match pydantic-core
15- rust-version = " 1.75 "
15+ rust-version = " 1.83 "
1616
1717[profile .bench ]
1818debug = true
@@ -25,5 +25,5 @@ inherits = "release"
2525debug = true
2626
2727[workspace .dependencies ]
28- pyo3 = { version = " 0.27 " }
29- pyo3-build-config = { version = " 0.27 " }
28+ pyo3 = { version = " 0.28 " }
29+ pyo3-build-config = { version = " 0.28 " }
Original file line number Diff line number Diff line change 11use pyo3:: exceptions:: { PyTypeError , PyValueError } ;
22use pyo3:: prelude:: * ;
3+ use pyo3:: py_format;
34use pyo3:: sync:: PyOnceLock ;
4- use pyo3:: types:: PyType ;
5+ use pyo3:: types:: { PyString , PyType } ;
56
67use crate :: Jiter ;
78
@@ -33,7 +34,7 @@ impl<'py> FromPyObject<'_, 'py> for FloatMode {
3334
3435/// Represents a float from JSON, by holding the underlying bytes representing a float from JSON.
3536#[ derive( Debug , Clone ) ]
36- #[ pyclass( module = "jiter" ) ]
37+ #[ pyclass( module = "jiter" , skip_from_py_object ) ]
3738pub struct LosslessFloat ( Vec < u8 > ) ;
3839
3940impl LosslessFloat {
@@ -78,8 +79,9 @@ impl LosslessFloat {
7879 std:: str:: from_utf8 ( & self . 0 ) . map_err ( |_| PyValueError :: new_err ( "Invalid UTF-8" ) )
7980 }
8081
81- fn __repr__ ( & self ) -> PyResult < String > {
82- self . __str__ ( ) . map ( |s| format ! ( "LosslessFloat({s})" ) )
82+ fn __repr__ < ' py > ( & self , py : Python < ' py > ) -> PyResult < Bound < ' py , PyString > > {
83+ let s = self . __str__ ( ) ?;
84+ py_format ! ( py, "LosslessFloat({s})" )
8385 }
8486}
8587
Original file line number Diff line number Diff line change @@ -393,7 +393,7 @@ fn utf8_range() {
393393fn utf8_range_long ( ) {
394394 for c in 0u8 ..255u8 {
395395 let mut json = vec ! [ b'"' , b':' , c] ;
396- json. extend ( std:: iter:: repeat ( b' ' ) . take ( 20 ) ) ;
396+ json. extend ( std:: iter:: repeat_n ( b' ' , 20 ) ) ;
397397 json. push ( b'"' ) ;
398398 // dbg!(c, json.iter().map(|b| *b as char).collect::<Vec<_>>());
399399
@@ -632,9 +632,9 @@ fn invalid_escape_position() {
632632fn simd_string_sizes ( ) {
633633 for i in 0 ..100 {
634634 let mut json = vec ! [ b'"' ] ;
635- json. extend ( std:: iter:: repeat ( b'a' ) . take ( i) ) ;
635+ json. extend ( std:: iter:: repeat_n ( b'a' , i) ) ;
636636 json. push ( b'"' ) ;
637- json. extend ( std:: iter:: repeat ( b' ' ) . take ( 40 ) ) ;
637+ json. extend ( std:: iter:: repeat_n ( b' ' , 40 ) ) ;
638638
639639 let value = JsonValue :: parse ( & json, false ) . unwrap ( ) ;
640640 let JsonValue :: Str ( s) = value else {
You can’t perform that action at this time.
0 commit comments