Skip to content

Commit 63b1d22

Browse files
authored
Merge pull request #2485 from davidhewitt/rework-capsule
types: rework PyCapsule for soundness
2 parents e40b252 + 2aa44b5 commit 63b1d22

File tree

2 files changed

+130
-64
lines changed

2 files changed

+130
-64
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242
- Allow `#[classattr]` methods to be fallible. [#2385](https://github.com/PyO3/pyo3/pull/2385)
4343
- Prevent multiple `#[pymethods]` with the same name for a single `#[pyclass]`. [#2399](https://github.com/PyO3/pyo3/pull/2399)
4444
- Fixup `lib_name` when using `PYO3_CONFIG_FILE`. [#2404](https://github.com/PyO3/pyo3/pull/2404)
45+
- Iterators over `PySet` and `PyDict` will now panic if the underlying collection is mutated during the iteration. [#2380](https://github.com/PyO3/pyo3/pull/2380)
4546
- Allow `#[classattr]` take `Python` argument. [#2456](https://github.com/PyO3/pyo3/pull/2456)
47+
- Rework `PyCapsule` type to resolve multiple soundness issues: [#2485](https://github.com/PyO3/pyo3/pull/2485)
48+
- `PyCapsule::new` and `PyCapsule::new_with_destructor` now take `name: Option<CString>` instead of `&CStr`.
49+
- The destructor `F` in `PyCapsule::new_with_destructor` must now be `Send`.
50+
- `PyCapsule::get_context` deprecated in favour of `PyCapsule::context` which doesn't take a `py: Python<'_>` argument.
51+
- `PyCapsule::set_context` no longer takes a `py: Python<'_>` argument.
52+
- `PyCapsule::name` now returns `PyResult<Option<&CStr>>` instead of `&CStr`.
4653
- `FromPyObject::extract` now raises an error if source type is `PyString` and target type is `Vec<T>`. [#2500](https://github.com/PyO3/pyo3/pull/2500)
4754

4855
### Removed

0 commit comments

Comments
 (0)