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

Cleanups to ensure GIL-safety of Py<T> and PyObject methods #970

Merged
merged 1 commit into from Jun 15, 2020

Conversation

davidhewitt
Copy link
Member

Closes #949

This introduces Python arguments to Py<T> and PyObject methods which really should be requiring the GIL.

Doing this higlighted a couple of other places across the codebase which could be tweaked:

  • PyTypeObject::type_object now returns &PyType instead of Py<PyType> - should be faster as now no reference count increase needed.
  • PyTuple::slice and PyTuple::split_from now return &PyTuple.

src/err.rs Show resolved Hide resolved
src/gil.rs Outdated Show resolved Hide resolved
Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

Thank you for this hard work!
I have a minor concern about naming but other than that LGTM 👍

@davidhewitt
Copy link
Member Author

Updated to use EnsureGIL struct instead of enum 👍

@kngwyu
Copy link
Member

kngwyu commented Jun 15, 2020

LGTM, thanks.

@kngwyu kngwyu merged commit 3e905eb into PyO3:master Jun 15, 2020
@davidhewitt davidhewitt deleted the py-gil-safe branch December 24, 2021 02:04
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.

Audit Py<T> methods for GIL safety
2 participants