Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate gil-refs in "self" position #3943

Merged
merged 4 commits into from
Mar 9, 2024

Conversation

Icxolu
Copy link
Contributor

@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...

pyo3-macros-backend/src/method.rs Outdated Show resolved Hide resolved
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
42 checks passed
@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