Skip to content

Commit

Permalink
cargo update, MSRV 1.65
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Oct 10, 2023
1 parent 1f54bd4 commit 04629eb
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
fail-fast: false
matrix:
rust: [
{ version: "1.60" }, # MSRV
{ version: "1.65" }, # MSRV
{ version: "nightly-2023-08-30" },
]
python: [
Expand All @@ -28,7 +28,7 @@ jobs:
python-version: '${{ matrix.python.version }}'
- run: python -m pip install --user --upgrade pip "maturin>=1,<2" wheel

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=default -y
- run: pip install -U autoflake isort black ruff mypy types-python-dateutil types-pytz types-simplejson types-ujson

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- run: cargo fmt
- run: ./script/lint
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
strategy:
fail-fast: false
env:
RUST_TOOLCHAIN: "1.60" # MSRV
RUST_TOOLCHAIN: "1.65" # MSRV
steps:
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_TOOLCHAIN -y
- run: rustup default $RUST_TOOLCHAIN

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- run: python3 -m pip install --user --upgrade pip "maturin>=1,<2" wheel

Expand Down Expand Up @@ -73,10 +73,9 @@ jobs:
- run: yum install -y clang lld
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2023-08-30 --profile minimal -y
- run: rustup component add rust-src --toolchain nightly-2023-08-30-x86_64-unknown-linux-gnu
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build-std
if: matrix.target.arch != 'aarch64'
run: |
mkdir .cargo
cp ci/config.toml .cargo/config.toml
Expand Down Expand Up @@ -128,10 +127,9 @@ jobs:
arch: x86_64
platform: linux/amd64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build-std
if: matrix.target.arch != 'aarch64'
run: |
mkdir .cargo
cp ci/config.toml .cargo/config.toml
Expand All @@ -153,7 +151,7 @@ jobs:

- name: Set up QEMU
if: matrix.platform.arch != 'x86_64'
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0
platforms: ${{ matrix.platform.platform }}
Expand Down Expand Up @@ -216,10 +214,9 @@ jobs:
},
]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build-std
if: matrix.target.arch != 'aarch64'
run: |
mkdir .cargo
cp ci/config.toml .cargo/config.toml
Expand Down
64 changes: 24 additions & 40 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["ijl <[email protected]>"]
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"
edition = "2021"
resolver = "2"
rust-version = "1.60"
rust-version = "1.65"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/ijl/orjson"
homepage = "https://github.com/ijl/orjson"
Expand Down Expand Up @@ -50,9 +50,9 @@ yyjson = []
[dependencies]
ahash = { version = "0.8", default_features = false }
arrayvec = { version = "0.7", default_features = false, features = ["std", "serde"] }
associative-cache = { version = "1", default_features = false }
associative-cache = { version = "2", default_features = false }
beef = { version = "0.5", default_features = false, features = ["impl_serde"] }
bytecount = { version = "^0.6.3", default_features = false, features = ["runtime-dispatch-simd"] }
bytecount = { version = "^0.6.4", default_features = false, features = ["runtime-dispatch-simd"] }
chrono = { version = "^0.4.24", default_features = false }
compact_str = { version = "0.7", default_features = false, features = ["serde"] }
encoding_rs = { version = "0.8", default_features = false }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ Probably not.

## Packaging

To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.60
To package orjson requires at least [Rust](https://www.rust-lang.org/) 1.65
and the [maturin](https://github.com/PyO3/maturin) build tool. The recommended
build command is:

Expand All @@ -1195,7 +1195,7 @@ It benefits from also having a C build environment to compile a faster
deserialization backend. See this project's `manylinux_2_28` builds for an
example using clang and LTO.

The project's own CI tests against `nightly-2023-08-30` and stable 1.60. It
The project's own CI tests against `nightly-2023-08-30` and stable 1.65. It
is prudent to pin the nightly version because that channel can introduce
breaking changes.

Expand Down
10 changes: 5 additions & 5 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12.0-rc.1'
versionSpec: '3.12.0'
addToPath: true
allowUnstable: true
- checkout: self
Expand Down Expand Up @@ -79,13 +79,13 @@ jobs:
pool:
vmImage: windows-2022
variables:
interpreter: C:\hostedtoolcache\windows\Python\3.12.0-rc.1\x64\python.exe
interpreter: C:\hostedtoolcache\windows\Python\3.12.0\x64\python.exe
rustup: https://win.rustup.rs/x86_64
target: x86_64-pc-windows-msvc
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12.0-rc.1'
versionSpec: '3.12.0'
addToPath: true
allowUnstable: true
architecture: 'x64'
Expand Down Expand Up @@ -160,13 +160,13 @@ jobs:
pool:
vmImage: windows-2022
variables:
interpreter: C:\hostedtoolcache\windows\Python\3.12.0-rc.1\x86\python.exe
interpreter: C:\hostedtoolcache\windows\Python\3.12.0\x86\python.exe
rustup: https://win.rustup.rs/x86
target: i686-pc-windows-msvc
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12.0-rc.1'
versionSpec: '3.12.0'
addToPath: true
allowUnstable: true
architecture: 'x86'
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python",
"Programming Language :: Rust",
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ macro_rules! str_hash {
#[cfg(Py_3_13)]
macro_rules! pydict_contains {
($obj1:expr, $obj2:expr) => {
unsafe { pyo3_ffi::PyDict_Contains((*$obj1).tp_dict, $obj2) == 1 }
unsafe { pyo3_ffi::PyDict_Contains(pyo3_ffi::PyType_GetDict($obj1), $obj2) == 1 }
};
}

Expand Down
36 changes: 36 additions & 0 deletions test/test_circular.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ def test_circular_dict(self):
with pytest.raises(orjson.JSONEncodeError):
orjson.dumps(obj)

def test_circular_dict_sort_keys(self):
"""
dumps() circular reference dict OPT_SORT_KEYS
"""
obj = {} # type: ignore
obj["obj"] = obj
with pytest.raises(orjson.JSONEncodeError):
orjson.dumps(obj, option=orjson.OPT_SORT_KEYS)

def test_circular_dict_non_str_keys(self):
"""
dumps() circular reference dict OPT_NON_STR_KEYS
"""
obj = {} # type: ignore
obj["obj"] = obj
with pytest.raises(orjson.JSONEncodeError):
orjson.dumps(obj, option=orjson.OPT_NON_STR_KEYS)

def test_circular_list(self):
"""
dumps() circular reference list
Expand All @@ -32,3 +50,21 @@ def test_circular_nested(self):
obj["list"] = [{"obj": obj}]
with pytest.raises(orjson.JSONEncodeError):
orjson.dumps(obj)

def test_circular_nested_sort_keys(self):
"""
dumps() circular reference nested dict, list OPT_SORT_KEYS
"""
obj = {} # type: ignore
obj["list"] = [{"obj": obj}]
with pytest.raises(orjson.JSONEncodeError):
orjson.dumps(obj, option=orjson.OPT_SORT_KEYS)

def test_circular_nested_non_str_keys(self):
"""
dumps() circular reference nested dict, list OPT_NON_STR_KEYS
"""
obj = {} # type: ignore
obj["list"] = [{"obj": obj}]
with pytest.raises(orjson.JSONEncodeError):
orjson.dumps(obj, option=orjson.OPT_NON_STR_KEYS)

0 comments on commit 04629eb

Please sign in to comment.