Skip to content

Commit

Permalink
2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Feb 24, 2020
1 parent ed51bac commit 41b9f69
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2.5.1 - 2020-02-24

### Changed

- `manylinux1` wheels for 3.6, 3.7, and 3.8 are now compliant with the spec by
not depending on glibc 2.18.

## 2.5.0 - 2020-02-19

### Added
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orjson"
version = "2.5.0"
version = "2.5.1"
authors = ["ijl <ijl@mailbox.org>"]
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"
edition = "2018"
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ support for 64-bit
file-like objects

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

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

To make a best effort at deserializing bad input, first decode `bytes` using
the `replace` or `lossy` argument for `errors`:

```python
>>> import orjson
>>> orjson.loads(b'"\xed\xa0\x80"')
JSONDecodeError: str is not valid UTF-8: surrogates not allowed
>>> orjson.loads(b'"\xed\xa0\x80"'.decode("utf-8", "replace"))
'���'
```

### UUID

orjson serializes `uuid.UUID` instances to
Expand Down
2 changes: 1 addition & 1 deletion src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn deserialize(ptr: *mut pyo3::ffi::PyObject) -> PyResult<NonNull<pyo3::ffi:
data = unsafe { std::str::from_utf8_unchecked(slice) };
} else {
return Err(JSONDecodeError::py_err((
"Input must be str or bytes",
"Input must be bytes, bytearray, or str",
"",
0,
)));
Expand Down

0 comments on commit 41b9f69

Please sign in to comment.