From e8dc22636cf505a9027f68836e4c26effad2017a Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 18 Oct 2020 11:06:56 -0400 Subject: [PATCH] Re-added dropped header --- CHANGELOG.md | 1 + src/types/iterator.rs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd5203f688..0c4f4d7ea9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added - Add support for building for CPython limited API. This required a few minor changes to runtime behaviour of of pyo3 `#[pyclass]` types. See the migration guide for full details. [#1152](https://github.com/PyO3/pyo3/pull/1152) - Add argument names to `TypeError` messages generated by pymethod wrappers. [#1212](https://github.com/PyO3/pyo3/pull/1212) diff --git a/src/types/iterator.rs b/src/types/iterator.rs index 5e5c562a8ee..90ff4cc434f 100644 --- a/src/types/iterator.rs +++ b/src/types/iterator.rs @@ -2,9 +2,9 @@ // // based on Daniel Grunwald's https://github.com/dgrunwald/rust-cpython -use crate::{ - ffi, AsPyPointer, PyAny, PyDowncastError, PyErr, PyNativeType, PyResult, PyTryFrom, Python, -}; +use crate::{ffi, AsPyPointer, PyAny, PyErr, PyNativeType, PyResult, Python}; +#[cfg(any(not(Py_LIMITED_API), Py_3_8))] +use crate::{PyDowncastError, PyTryFrom}; /// A Python iterator object. /// @@ -28,6 +28,7 @@ use crate::{ #[repr(transparent)] pub struct PyIterator(PyAny); pyobject_native_type_named!(PyIterator); +#[cfg(any(not(Py_LIMITED_API), Py_3_8))] pyobject_native_type_extract!(PyIterator); impl PyIterator { @@ -202,6 +203,7 @@ mod tests { } #[test] + #[cfg(any(not(Py_LIMITED_API), Py_3_8))] fn iterator_try_from() { let gil_guard = Python::acquire_gil(); let py = gil_guard.python();