Skip to content

Commit e62b7cc

Browse files
davidhewitthonzaspTpt
authored
soundness for capsule reference and name (#5474)
* Add safer methods to PyCapsule that check the capsule name * soundness for `reference` and `name` * remove `reference_checked` * clippy * review feedback * SAFETY notes on unsafe blocks * return capsule name as `CapsuleName` struct * update newsfragment * review feedback * typo * clippy * fingers crossed... * Update src/types/capsule.rs Co-authored-by: Thomas Tanon <[email protected]> --------- Co-authored-by: Jan Špaček <[email protected]> Co-authored-by: Thomas Tanon <[email protected]>
1 parent 9f3d51d commit e62b7cc

File tree

5 files changed

+302
-98
lines changed

5 files changed

+302
-98
lines changed

newsfragments/5474.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
added checked methods into `PyCapsuleMethods`: `pointer_checked()`, `is_valid_checked()`

newsfragments/5474.changed.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Deprecate unchecked `PyCapsuleMethods`: `pointer()`, `reference()`, `is_valid()`
2+
Reduce lifetime of return value in `PyCapsuleMethods::reference`
3+
`PyCapsuleMethods::name` now returns `CapsuleName` wrapper instead of `&CStr`.

0 commit comments

Comments
 (0)