-
Notifications
You must be signed in to change notification settings - Fork 806
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PyWeakref_GetRef and use it in weakref wrappers. (#4528)
* add FFI bindings and a compat definition for PyWeakref_GetRef * implement get_object method of weakref wrappers using PyWeakref_GetRef * add changelog * rename _ref argument to reference * mark PyWeakref_GetObject as deprecated * mark test as using deprecated API item * update docs to reference PyWeakref_GetRef semantics * remove weakref methods that return borrowed references * fix lints about unused imports
- Loading branch information
Showing
7 changed files
with
116 additions
and
1,318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Added bindings for `pyo3_ffi::PyWeakref_GetRef` on Python 3.13 and newer and | ||
`py03_ffi::compat::PyWeakref_GetRef` for older Python versions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.