Skip to content

deprecate Bound|Py::(try_)borrow(_mut) (Part 2)#6121

Draft
Icxolu wants to merge 2 commits into
PyO3:mainfrom
Icxolu:deprecate/borrow
Draft

deprecate Bound|Py::(try_)borrow(_mut) (Part 2)#6121
Icxolu wants to merge 2 commits into
PyO3:mainfrom
Icxolu:deprecate/borrow

Conversation

@Icxolu

@Icxolu Icxolu commented Jun 9, 2026

Copy link
Copy Markdown
Member

Part 2 of #6120

Deprecates (try_)borrow(_mut) family of methods on Bound and Py, and introducing try_borrow_guard and try_borrow_guard_mut as successors (to be renamed back at some later release). I intentionally did not reintroduce panicking variants. I think the error condition got more likely now with free-threading and we should encourage users to handle such errors gracefully.

Only the second commit is relevant, first commit is #6120. I'll rebase once #6120 lands.

  • Write migration guide entry

See also #6083

@Icxolu Icxolu force-pushed the deprecate/borrow branch 3 times, most recently from 7e16282 to 09a3996 Compare June 9, 2026 19:30
@Icxolu Icxolu force-pushed the deprecate/borrow branch from 09a3996 to f09723b Compare June 11, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant