Skip to content

deprecate gil-refs in "self" position#3943

Merged
davidhewitt merged 4 commits intoPyO3:mainfrom
Icxolu:deprecate-self-gil-ref
Mar 9, 2024
Merged

deprecate gil-refs in "self" position#3943
davidhewitt merged 4 commits intoPyO3:mainfrom
Icxolu:deprecate-self-gil-ref

Conversation

@Icxolu
Copy link
Member

@Icxolu Icxolu commented Mar 8, 2024

Following #3936 / #3847

This deprecates the use of gil-ref types in "self" argument position. This includes #[pyfunction] with pass_module, the cls argument of #[classmethod] and &PyCell<Self> for normal #[pymethods]. (It seems like #[getter] and #[setter] use a different mechanism)

@Icxolu Icxolu added the CI-skip-changelog Skip checking changelog entry label Mar 8, 2024
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! Just one tiny nit, l'll apply it then merge...

Comment on lines +635 to +637
let (call, self_arg_span) = rust_call(args, &self_e, &mut holders);
let extract_gil_ref =
quote_spanned! { self_arg_span => #self_e.extract_gil_ref(); };
Copy link
Member

Choose a reason for hiding this comment

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

It'll be nice to refactor this all again a bit later to reduce duplication. I haven't got an obvious idea how though, so I'm happy to move ahead like this in time for beta / final release 👍

@davidhewitt davidhewitt enabled auto-merge March 9, 2024 09:21
@davidhewitt davidhewitt added this pull request to the merge queue Mar 9, 2024
Merged via the queue into PyO3:main with commit 908e661 Mar 9, 2024
@Icxolu Icxolu deleted the deprecate-self-gil-ref branch March 9, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-skip-changelog Skip checking changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants