-
Notifications
You must be signed in to change notification settings - Fork 796
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
Bump version to 0.11.0 #989
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should note that 'if you are sure that your class is not sent to another thread, you can use
unsafe impl Send for YourClass {}
' first. Actually it's rare to send pyclass to another thread, and I saw some#[pyclass]
es that have a raw pointer internally and needunsafe impl Send
when investigating the effect of this change.Also, we have to note that it's theoretically unsound, but not problematic when the class is not actually sent to another thread by:
py.allow_threads
andPy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's good advice. It undermines protections on the Rust side, too.
I don't know about your experience, but I use the threading module quite a lot in Python, and objects are accessed freely from any thread there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback.
Maybe it's because I use Python mainly for machine learning research, where CPU/GPU bound is dominant.
Then I would rather take back my words... but I still think we should note that
unsafe impl Sync
can be the easiest fix. Maybe it's also helpful to linkstd::marker::Send
or nomicon.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not keen on suggestingunsafe impl Send
orunsafe impl Sync
- to me that feels like the kind of hack where "I know that I'm not using threads now, so I can skip writing safe code". Later on this hack is forgotten, the code gets edited to include threading and suddenly very strange bugs / crashes / undefined behaviour.EDIT: changed my mind. I'm ok to suggest adding
unsafe impl Send
as long as we carefully explain that the responsibility is on the user to ensure the type is also thread-safe. But we have to explain this really clearly - because the undefined behaviour the user might see if they get this wrong could be pretty bad.(My description of using
unsafe impl Send
as a hack still applies when the user uses it to skip making a type thread-safe.)Adding in a link to docs / nomicon would be fine though.