Merge pull request #2217 from davidhewitt/pypy-7.3.8

pypy: support 7.3.8
This commit is contained in:
David Hewitt 2022-03-09 08:43:46 +00:00 committed by GitHub
commit e625c5dd7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 6 deletions

View File

@ -84,7 +84,7 @@ jobs:
"3.9",
"3.10",
"3.11-dev",
"pypy-3.7-v7.3.7",
"pypy-3.7",
"pypy-3.8",
"pypy-3.9"
]
@ -113,7 +113,7 @@ jobs:
]
exclude:
# PyPy doesn't release 32-bit Windows builds any more
- python-version: pypy-3.7-v7.3.7
- python-version: pypy-3.7
platform: { os: "windows-latest", python-architecture: "x86" }
- python-version: pypy-3.8
platform: { os: "windows-latest", python-architecture: "x86" }

View File

@ -6,6 +6,12 @@ PyO3 versions, please see the [migration guide](https://pyo3.rs/latest/migration
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Packaging
- Warn when modules are imported on PyPy 3.7 versions older than PyPy 7.3.8, as they are known to have binary compatibility issues. [#2217](https://github.com/PyO3/pyo3/pull/2217)
## [0.16.1] - 2022-03-05
### Packaging

View File

@ -359,7 +359,6 @@ pub struct PyDateTime_CAPI {
pub TimeType: *mut PyTypeObject,
pub DeltaType: *mut PyTypeObject,
pub TZInfoType: *mut PyTypeObject,
#[cfg(not(all(PyPy, not(Py_3_8))))]
pub TimeZone_UTC: *mut PyObject,
pub Date_FromDate: unsafe extern "C" fn(
year: c_int,
@ -393,7 +392,6 @@ pub struct PyDateTime_CAPI {
normalize: c_int,
cls: *mut PyTypeObject,
) -> *mut PyObject,
#[cfg(not(all(PyPy, not(Py_3_8))))]
pub TimeZone_FromTimeZone:
unsafe extern "C" fn(offset: *mut PyObject, name: *mut PyObject) -> *mut PyObject,
@ -442,7 +440,6 @@ pub unsafe fn PyDateTimeAPI() -> *mut PyDateTime_CAPI {
*PyDateTimeAPI_impl.0.get()
}
#[cfg(not(all(PyPy, not(Py_3_8))))]
#[inline]
pub unsafe fn PyDateTime_TimeZone_UTC() -> *mut PyObject {
(*PyDateTimeAPI()).TimeZone_UTC

View File

@ -41,7 +41,6 @@ fn test_date_fromtimestamp() {
}
#[test]
#[cfg(not(all(PyPy, not(Py_3_8))))]
fn test_utc_timezone() {
Python::with_gil(|py| {
let utc_timezone = unsafe {

View File

@ -71,6 +71,21 @@ impl ModuleDef {
panic_result_into_callback_output(
py,
std::panic::catch_unwind(move || -> PyResult<_> {
#[cfg(all(PyPy, not(Py_3_8)))]
{
const PYPY_GOOD_VERSION: [u8; 3] = [7, 3, 8];
let version = py
.import("sys")?
.getattr("implementation")?
.getattr("version")?;
if version.lt(crate::types::PyTuple::new(py, &PYPY_GOOD_VERSION))? {
let warn = py.import("warnings")?.getattr("warn")?;
warn.call1((
"PyPy 3.7 versions older than 7.3.8 are known to have binary \
compatibility issues which may cause segfaults. Please upgrade.",
))?;
}
}
Ok(unwind_safe_self.make_module(py)?.into_ptr())
}),
)