Skip to content

Commit 203dec2

Browse files
Disable on pypy
1 parent 657ac7f commit 203dec2

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

pyo3-ffi/src/compat/py_3_14.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ compat_function!(
2525
}
2626
);
2727

28-
#[cfg(not(Py_LIMITED_API))]
28+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
2929
compat_function!(
3030
originally_defined_for(all(Py_3_14, not(Py_LIMITED_API)));
3131

@@ -50,7 +50,7 @@ compat_function!(
5050
}
5151
);
5252

53-
#[cfg(not(Py_LIMITED_API))]
53+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
5454
compat_function!(
5555
originally_defined_for(all(Py_3_14, not(Py_LIMITED_API)));
5656

@@ -61,7 +61,7 @@ compat_function!(
6161
}
6262
);
6363

64-
#[cfg(not(Py_LIMITED_API))]
64+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
6565
compat_function!(
6666
originally_defined_for(all(Py_3_14, not(Py_LIMITED_API)));
6767

@@ -71,7 +71,7 @@ compat_function!(
7171
}
7272
);
7373

74-
#[cfg(not(Py_LIMITED_API))]
74+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
7575
compat_function!(
7676
originally_defined_for(all(Py_3_14, not(Py_LIMITED_API)));
7777

@@ -88,7 +88,7 @@ compat_function!(
8888
}
8989
);
9090

91-
#[cfg(not(Py_LIMITED_API))]
91+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
9292
compat_function!(
9393
originally_defined_for(all(Py_3_14, not(Py_LIMITED_API)));
9494

src/fmt.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! constructing Python strings using Rust's `fmt::Write` trait.
33
//! It allows for incremental string construction, without the need for repeated allocations, and
44
//! is particularly useful for building strings in a performance-sensitive context.
5-
#[cfg(not(Py_LIMITED_API))]
5+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
66
use {
77
crate::ffi::compat::{
88
PyUnicodeWriter_Create, PyUnicodeWriter_Discard, PyUnicodeWriter_Finish,
@@ -24,14 +24,14 @@ macro_rules! py_format {
2424
}
2525
}
2626

27-
#[cfg(not(Py_LIMITED_API))]
27+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
2828
/// The `PyUnicodeWriter` is a utility for efficiently constructing Python strings
2929
pub struct PyUnicodeWriter {
3030
writer: NonNull<ffi::PyUnicodeWriter>,
3131
last_error: Option<PyErr>,
3232
}
3333

34-
#[cfg(not(Py_LIMITED_API))]
34+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
3535
impl PyUnicodeWriter {
3636
/// Creates a new `PyUnicodeWriter`.
3737
pub fn new(py: Python<'_>) -> PyResult<Self> {
@@ -76,7 +76,7 @@ impl PyUnicodeWriter {
7676
}
7777
}
7878

79-
#[cfg(not(Py_LIMITED_API))]
79+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
8080
impl fmt::Write for PyUnicodeWriter {
8181
fn write_str(&mut self, s: &str) -> fmt::Result {
8282
let result = unsafe {
@@ -101,7 +101,7 @@ impl fmt::Write for PyUnicodeWriter {
101101
}
102102
}
103103

104-
#[cfg(not(Py_LIMITED_API))]
104+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
105105
impl Drop for PyUnicodeWriter {
106106
fn drop(&mut self) {
107107
unsafe {
@@ -112,14 +112,14 @@ impl Drop for PyUnicodeWriter {
112112

113113
#[cfg(test)]
114114
mod tests {
115-
#[cfg(not(Py_LIMITED_API))]
115+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
116116
use super::*;
117117
use crate::types::PyStringMethods;
118118
use crate::{IntoPyObject, Python};
119119

120120
#[test]
121121
#[allow(clippy::write_literal)]
122-
#[cfg(not(Py_LIMITED_API))]
122+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
123123
fn unicode_writer_test() {
124124
use std::fmt::Write;
125125
Python::with_gil(|py| {

src/types/string.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(not(Py_LIMITED_API))]
22
use crate::exceptions::PyUnicodeDecodeError;
33
use crate::ffi_ptr_ext::FfiPtrExt;
4-
#[cfg(not(Py_LIMITED_API))]
4+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
55
use crate::fmt::PyUnicodeWriter;
66
use crate::instance::Borrowed;
77
use crate::py_result_ext::PyResultExt;
@@ -11,7 +11,7 @@ use crate::types::PyBytes;
1111
use crate::{ffi, Bound, Py, PyAny, PyResult, Python};
1212
use std::borrow::Cow;
1313
use std::ffi::CString;
14-
#[cfg(not(Py_LIMITED_API))]
14+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
1515
use std::fmt::Write as _;
1616
use std::{fmt, str};
1717

@@ -225,7 +225,7 @@ impl PyString {
225225
return Ok(PyString::new(py, static_string));
226226
};
227227

228-
#[cfg(not(Py_LIMITED_API))]
228+
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
229229
{
230230
let mut writer = PyUnicodeWriter::new(py)?;
231231
writer
@@ -234,7 +234,7 @@ impl PyString {
234234
writer.into_py_string(py)
235235
}
236236

237-
#[cfg(Py_LIMITED_API)]
237+
#[cfg(any(Py_LIMITED_API, PyPy))]
238238
{
239239
Ok(PyString::new(py, &format!("{args}")))
240240
}

0 commit comments

Comments
 (0)