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

implement Send and Sync for PyBackedStr and PyBackedBytes #4007

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented Mar 28, 2024

I noticed while working on my PyO3 tutorial today that the PyBackedStr and PyBackedBytes types do not implement Send or Sync, because they have a NonNull pointer inside them.

I think it should be perfectly safe to implement Send and Sync here, because these types are immutable and the Py smart pointer is already Send and Sync.

Copy link
Member

@adamreichold adamreichold left a comment

Choose a reason for hiding this comment

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

Storing NonNull<str> instead of NonNull<[u8]> is certainly a nice expansion of type safety.

@davidhewitt davidhewitt added this pull request to the merge queue Mar 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 29, 2024
@davidhewitt
Copy link
Member Author

PyPy fix can't come soon enough :)

@davidhewitt davidhewitt added this pull request to the merge queue Mar 29, 2024
Merged via the queue into PyO3:main with commit b053e83 Mar 29, 2024
41 of 43 checks passed
@davidhewitt davidhewitt deleted the backed-send-sync branch March 29, 2024 12:34
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.

3 participants