Skip to content

Commit b078588

Browse files
committed
fix graalpy issue
1 parent ab43f5f commit b078588

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

guide/src/class.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,16 @@ It can either return `()` or `PyResult<()>`.
210210
```rust
211211
# #![allow(dead_code)]
212212
# use pyo3::prelude::*;
213-
# #[cfg(not(Py_LIMITED_API))]
213+
# #[cfg(not(any(Py_LIMITED_API, GraalPy)))]
214214
use pyo3::types::{PyDict, PyTuple, PySuper};
215-
# #[cfg(not(Py_LIMITED_API))]
215+
# #[cfg(not(any(Py_LIMITED_API, GraalPy)))]
216216
use crate::pyo3::PyTypeInfo;
217217

218-
# #[cfg(not(Py_LIMITED_API))]
218+
# #[cfg(not(any(Py_LIMITED_API, GraalPy)))]
219219
#[pyclass(extends = PyDict)]
220220
struct MyDict;
221221

222-
# #[cfg(not(Py_LIMITED_API))]
222+
# #[cfg(not(any(Py_LIMITED_API, GraalPy)))]
223223
#[pymethods]
224224
impl MyDict {
225225
# #[allow(unused_variables)]
@@ -249,7 +249,7 @@ impl MyDict {
249249
}
250250
}
251251

252-
# #[cfg(not(Py_LIMITED_API))]
252+
# #[cfg(not(any(Py_LIMITED_API, GraalPy)))]
253253
# fn main() {
254254
# Python::attach(|py| {
255255
# let typeobj = py.get_type::<MyDict>();
@@ -258,7 +258,7 @@ impl MyDict {
258258
# assert_eq!(obj.get_item("my_key").unwrap().extract::<&str>().unwrap(), "always insert this key");
259259
# });
260260
# }
261-
# #[cfg(Py_LIMITED_API)]
261+
# #[cfg(any(Py_LIMITED_API, GraalPy))]
262262
# fn main() {}
263263
```
264264

pytests/src/pyclasses.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ impl ClassWithDict {
106106
}
107107
}
108108

109-
#[cfg(not(any(Py_LIMITED_API)))] // Can't subclass native types on abi3 yet
109+
#[cfg(not(any(Py_LIMITED_API, GraalPy)))] // Can't subclass native types on abi3 yet
110110
#[pyclass(extends = PyDict)]
111111
struct SubClassWithInit;
112112

113-
#[cfg(not(any(Py_LIMITED_API)))]
113+
#[cfg(not(any(Py_LIMITED_API, GraalPy)))]
114114
#[pymethods]
115115
impl SubClassWithInit {
116116
#[new]
@@ -203,7 +203,7 @@ pub mod pyclasses {
203203
#[cfg(any(Py_3_10, not(Py_LIMITED_API)))]
204204
#[pymodule_export]
205205
use super::ClassWithDict;
206-
#[cfg(not(any(Py_LIMITED_API)))]
206+
#[cfg(not(any(Py_LIMITED_API, GraalPy)))]
207207
#[pymodule_export]
208208
use super::SubClassWithInit;
209209
#[pymodule_export]

pytests/stubs/pyclasses.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class PyClassThreadIter:
5454
def __next__(self, /) -> int: ...
5555

5656
@final
57-
class SubClassWithInit:
57+
class SubClassWithInit(dict):
5858
def __init__(self, /, *args, **kwargs) -> Any: ...
5959
def __new__(cls, /, *args, **kwargs) -> SubClassWithInit: ...
6060

0 commit comments

Comments
 (0)