Skip to content

Commit 41b9f69

Browse files
committed
2.5.1
1 parent ed51bac commit 41b9f69

5 files changed

Lines changed: 34 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 2.5.1 - 2020-02-24
4+
5+
### Changed
6+
7+
- `manylinux1` wheels for 3.6, 3.7, and 3.8 are now compliant with the spec by
8+
not depending on glibc 2.18.
9+
310
## 2.5.0 - 2020-02-19
411

512
### Added

Cargo.lock

Lines changed: 13 additions & 13 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
@@ -1,6 +1,6 @@
11
[package]
22
name = "orjson"
3-
version = "2.5.0"
3+
version = "2.5.1"
44
authors = ["ijl <ijl@mailbox.org>"]
55
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"
66
edition = "2018"

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ support for 64-bit
3131
file-like objects
3232

3333
orjson supports CPython 3.6, 3.7, 3.8, and 3.9. It distributes wheels for
34-
Linux, macOS, and Windows. The manylinux1 wheel differs from PEP 513 in
35-
requiring glibc 2.18, released 2013, or later. orjson does not support PyPy.
34+
Linux, macOS, and Windows. orjson does not support PyPy.
3635

3736
orjson is licensed under both the Apache 2.0 and MIT licenses. The
3837
repository and issue tracker is
@@ -632,6 +631,17 @@ ValueError: Parse error at offset 1: The surrogate pair in string is invalid.
632631
'\ud800'
633632
```
634633

634+
To make a best effort at deserializing bad input, first decode `bytes` using
635+
the `replace` or `lossy` argument for `errors`:
636+
637+
```python
638+
>>> import orjson
639+
>>> orjson.loads(b'"\xed\xa0\x80"')
640+
JSONDecodeError: str is not valid UTF-8: surrogates not allowed
641+
>>> orjson.loads(b'"\xed\xa0\x80"'.decode("utf-8", "replace"))
642+
'���'
643+
```
644+
635645
### UUID
636646

637647
orjson serializes `uuid.UUID` instances to

src/decode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn deserialize(ptr: *mut pyo3::ffi::PyObject) -> PyResult<NonNull<pyo3::ffi:
7979
data = unsafe { std::str::from_utf8_unchecked(slice) };
8080
} else {
8181
return Err(JSONDecodeError::py_err((
82-
"Input must be str or bytes",
82+
"Input must be bytes, bytearray, or str",
8383
"",
8484
0,
8585
)));

0 commit comments

Comments
 (0)