Assorted updates to the abi3 branch from review

This commit is contained in:
Alex Gaynor 2020-10-11 19:51:27 -04:00
parent 137196d8c3
commit aabad7cf7f
5 changed files with 7 additions and 6 deletions

View File

@ -35,7 +35,8 @@ rustversion = "1.0"
[features]
default = ["macros"]
macros = ["ctor", "indoc", "inventory", "paste", "pyo3cls", "unindent"]
# Use only limited API. See https://www.python.org/dev/peps/pep-0384/ for more.
# Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for
# more.
abi3 = []
# Optimizes PyObject to Vec conversion and so on.

View File

@ -328,5 +328,5 @@ def test_tz_class_introspection():
tzi = rdt.TzClass()
assert tzi.__class__ == rdt.TzClass
# PyPy generate <importlib.bootstrap.TzClass ...> for some reason.
# PyPy generates <importlib.bootstrap.TzClass ...> for some reason.
assert re.match(r"^<[\w\.]*TzClass object at", repr(tzi))

View File

@ -266,7 +266,7 @@ impl SubSubClass {
```
You can also inherit native types such as `PyDict`, if they implement
[`PySizedLayout`](https://docs.rs/pyo3/latest/pyo3/type_object/trait.PySizedLayout.html).
[`PySizedLayout`](https://docs.rs/pyo3/latest/pyo3/type_object/trait.PySizedLayout.html). However, this is not supported when building for the Python limited API (aka the `abi3` feature of PyO3).
However, because of some technical problems, we don't currently provide safe upcasting methods for types
that inherit native types. Even in such cases, you can unsafely get a base class by raw pointer conversion.

View File

@ -32,7 +32,7 @@ fn class_with_docs() {
}
#[test]
#[cfg_attr(Py_LIMITED_API, ignore)]
#[cfg_attr(all(Py_LIMITED_API, not(Py_3_10)), ignore)]
fn class_with_docs_and_signature() {
/// docs line1
#[pyclass]
@ -68,7 +68,7 @@ fn class_with_docs_and_signature() {
}
#[test]
#[cfg_attr(Py_LIMITED_API, ignore)]
#[cfg_attr(all(Py_LIMITED_API, not(Py_3_10)), ignore)]
fn class_with_signature() {
#[pyclass]
#[text_signature = "(a, b=None, *, c=42)"]

View File

@ -1,4 +1,4 @@
//! With abi3, we cannot inherite native types.
//! With abi3, we cannot inherit native types.
use pyo3::prelude::*;
use pyo3::types::PyDict;