diff --git a/CHANGELOG.md b/CHANGELOG.md index d75099b4..cbbaef21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cargo.lock b/Cargo.lock index 9fe0dbdb..bf645486 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,9 +76,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8ce37ad4184ab2ce004c33bf6379185d3b1c95801cab51026bd271bf68eedc" +checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" dependencies = [ "quote", "syn", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.66" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" [[package]] name = "lock_api" @@ -247,9 +247,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "num-traits" @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "orjson" -version = "2.5.0" +version = "2.5.1" dependencies = [ "associative-cache", "encoding_rs", @@ -315,9 +315,9 @@ dependencies = [ [[package]] name = "paste" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "423a519e1c6e828f1e73b720f9d9ed2fa643dce8a7737fb43235ce0b41eeaa49" +checksum = "63e1afe738d71b1ebab5f1207c055054015427dbfc7bbe9ee1266894156ec046" dependencies = [ "paste-impl", "proc-macro-hack", @@ -325,9 +325,9 @@ dependencies = [ [[package]] name = "paste-impl" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4214c9e912ef61bf42b81ba9a47e8aad1b2ffaf739ab162bf96d1e011f54e6c5" +checksum = "6d4dc4a7f6f743211c5aab239640a65091535d97d43d92a52bca435a640892bb" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -559,9 +559,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" +checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 27f63bb1..96de2a68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "orjson" -version = "2.5.0" +version = "2.5.1" authors = ["ijl "] description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy" edition = "2018" diff --git a/README.md b/README.md index 75d2915f..38c290d7 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/src/decode.rs b/src/decode.rs index 6032de23..c763e5fc 100644 --- a/src/decode.rs +++ b/src/decode.rs @@ -79,7 +79,7 @@ pub fn deserialize(ptr: *mut pyo3::ffi::PyObject) -> PyResult