Skip to content

Commit

Permalink
Fix Python 3.13 alpha 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Feb 3, 2024
1 parent 58a8bd3 commit 323a930
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:
{ rust: "nightly-2024-01-17", features: "--features=yyjson,unstable-simd" },
]
python: [
{ version: '3.12', abi: 'cp312-cp312' },
{ version: '3.8', abi: 'cp38-cp38' },
{ version: '3.13' },
{ version: '3.12' },
{ version: '3.8' },
]
env:
CC: "gcc"
Expand All @@ -26,7 +27,9 @@ jobs:

- uses: actions/setup-python@v5
with:
allow-prereleases: true
python-version: '${{ matrix.python.version }}'

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

- uses: actions/checkout@v4
Expand All @@ -43,9 +46,15 @@ jobs:
- run: python -m pip install --user -r test/requirements.txt -r integration/requirements.txt

- run: pytest -s -rxX -v test
timeout-minutes: 4
env:
PYTHONMALLOC: "debug"

- run: ./integration/run thread
timeout-minutes: 2

- run: ./integration/run http
timeout-minutes: 2

- run: ./integration/run init
timeout-minutes: 2
8 changes: 8 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,20 @@ macro_rules! use_immortal {
};
}

#[cfg(not(Py_3_13))]
macro_rules! pydict_next {
($obj1:expr, $obj2:expr, $obj3:expr, $obj4:expr) => {
unsafe { pyo3_ffi::_PyDict_Next($obj1, $obj2, $obj3, $obj4, std::ptr::null_mut()) }
};
}

#[cfg(Py_3_13)]
macro_rules! pydict_next {
($obj1:expr, $obj2:expr, $obj3:expr, $obj4:expr) => {
unsafe { pyo3_ffi::PyDict_Next($obj1, $obj2, $obj3, $obj4) }
};
}

macro_rules! reserve_minimum {
($writer:expr) => {
$writer.reserve(64);
Expand Down

0 comments on commit 323a930

Please sign in to comment.