Skip to content

Commit

Permalink
remove weakref methods that return borrowed references
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoldbaum committed Sep 26, 2024
1 parent dd8236d commit 77c35c6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1,307 deletions.
7 changes: 7 additions & 0 deletions newsfragments/4528.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* Removed the `get_object_borrowed`, `upgrade_borrowed`, `upgrade_borrowed_as`,
`upgrade_borrowed_as_unchecked`, `upgrade_borrowed_as_exact` methods of
`PyWeakref` and `PyWeakrefProxy`. These returned borrowed references to weakly
referenced data, and in principle if the GIL is released the last strong
reference could be released, allowing a possible use-after-free error. If you
are using these functions, you should change to the equivalent function that
returns a `Bound<'py, T>` reference.
Loading

0 comments on commit 77c35c6

Please sign in to comment.