Skip to content

deprecate PyRef(Mut) (Part 1)#6120

Open
Icxolu wants to merge 1 commit into
PyO3:mainfrom
Icxolu:deprecate/pyref
Open

deprecate PyRef(Mut) (Part 1)#6120
Icxolu wants to merge 1 commit into
PyO3:mainfrom
Icxolu:deprecate/pyref

Conversation

@Icxolu

@Icxolu Icxolu commented Jun 9, 2026

Copy link
Copy Markdown
Member

First step of deprecating PyRef and PyRefMut. This PR deprecates the types itself (targeting 0.30.0 as per #6083 (comment), so leaving as draft for now)

We will need a migration guide entry, but I would like to defer that to the second part when I deprecate the borrow methods.

See also #6083

@Icxolu Icxolu force-pushed the deprecate/pyref branch from e227e36 to 296de11 Compare June 9, 2026 19:01
Comment thread tests/ui/traverse.rs

#[pymethods]
impl TraverseTriesToTakePyRef {
#[expect(deprecated)]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just expected these for now. PyClassGuard(Mut) does give the same error, PyClassGuard could be allowed I guess, since it is not mutable and does not give access to a Python token. Not sure if that's worth the effort though

@Icxolu Icxolu force-pushed the deprecate/pyref branch 2 times, most recently from 629eb51 to a76cce0 Compare June 9, 2026 19:30
@codspeed-hq

codspeed-hq Bot commented Jun 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 126 untouched benchmarks


Comparing Icxolu:deprecate/pyref (62c855b) with main (0f90242)

Open in CodSpeed

@Icxolu Icxolu force-pushed the deprecate/pyref branch from a76cce0 to 62c855b Compare June 11, 2026 20:27
@Icxolu Icxolu marked this pull request as ready for review June 11, 2026 20:27
@Icxolu Icxolu mentioned this pull request Jun 19, 2026
4 tasks
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