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 4 times, most recently from 09a3996 to f09723b Compare June 11, 2026 20:27
@Icxolu Icxolu mentioned this pull request Jun 19, 2026
7 tasks
@Icxolu
Icxolu force-pushed the deprecate/borrow branch from f09723b to 27d2e32 Compare August 1, 2026 20:31
@codspeed-hq

codspeed-hq Bot commented Sep 12, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 10.55%

⚡ 1 improved benchmark
✅ 140 untouched benchmarks
⏩ 6 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_empty_class_init 31.6 µs 28.6 µs +10.55%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Icxolu:deprecate/borrow (072ece1) with main (ee629fb)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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