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

Rename Python::with_gil -> with_python ? #3987

Open
davidhewitt opened this issue Mar 23, 2024 · 1 comment
Open

Rename Python::with_gil -> with_python ? #3987

davidhewitt opened this issue Mar 23, 2024 · 1 comment

Comments

@davidhewitt
Copy link
Member

An idea with the upcoming free threaded Python around the corner.

Maybe instead of Python::with_gil, a future PyO3 API can just be pyo3::with_python. No functional difference except dropping the GIL name as that won't always be relevant.

e.g.

Python::with_gil(|py| /* do stuff */)

becomes just

with_python(|py| /* do stuff */)

Maybe we include with_python in the prelude, maybe we invite users to import it.

@Icxolu
Copy link
Contributor

Icxolu commented Mar 30, 2024

Just throwing some alternatives in the room: Python::in_scope or Python::with_token could also be something if we want to keep it as an (associated) method, but without references to the gil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants