Skip to content

Commit

Permalink
Merge pull request #961 from kngwyu/slot-provider
Browse files Browse the repository at this point in the history
Object protocols without specialization
  • Loading branch information
kngwyu authored Jun 18, 2020
2 parents 6ea8345 + 8a0c9bf commit 390ff5f
Show file tree
Hide file tree
Showing 23 changed files with 1,374 additions and 2,244 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Change return type of `PyTuple::as_slice` to `&[&PyAny]`. [#971](https://github.com/PyO3/pyo3/pull/971)
- Update `num-complex` optional dependendency from `0.2` to `0.3`. [#977](https://github.com/PyO3/pyo3/pull/977)
- Update `num-bigint` optional dependendency from `0.2` to `0.3`. [#978](https://github.com/PyO3/pyo3/pull/978)
- `#[pyproto]` is re-implemented without specialization. [#961](https://github.com/PyO3/pyo3/pull/961)

### Removed
- Remove `ManagedPyRef` (unused, and needs specialization) [#930](https://github.com/PyO3/pyo3/pull/930)
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ travis-ci = { repository = "PyO3/pyo3", branch = "master" }
appveyor = { repository = "fafhrd91/pyo3" }

[dependencies]
ctor = { version = "0.1", optional = true }
indoc = { version = "0.3.4", optional = true }
inventory = { version = "0.1.4", optional = true }
libc = "0.2.62"
Expand All @@ -38,7 +39,7 @@ version_check = "0.9.1"

[features]
default = ["macros"]
macros = ["indoc", "inventory", "paste", "pyo3cls", "unindent"]
macros = ["ctor", "indoc", "inventory", "paste", "pyo3cls", "unindent"]

# this is no longer needed internally, but setuptools-rust assumes this feature
python3 = []
Expand Down
8 changes: 8 additions & 0 deletions guide/src/class.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,14 @@ impl pyo3::class::methods::HasMethodsInventory for MyClass {
type Methods = Pyo3MethodsInventoryForMyClass;
}
pyo3::inventory::collect!(Pyo3MethodsInventoryForMyClass);

impl pyo3::class::proto_methods::HasProtoRegistry for MyClass {
fn registry() -> &'static pyo3::class::proto_methods::PyProtoRegistry {
static REGISTRY: pyo3::class::proto_methods::PyProtoRegistry
= pyo3::class::proto_methods::PyProtoRegistry::new();
&REGISTRY
}
}
# let gil = Python::acquire_gil();
# let py = gil.python();
# let cls = py.get_type::<MyClass>();
Expand Down
Loading

0 comments on commit 390ff5f

Please sign in to comment.