-
Notifications
You must be signed in to change notification settings - Fork 763
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
Move the ThreadChecker field in front of dict and weakref. #1058
Conversation
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.
That sounds like the correct fix to me, thanks!
Could you please add a CHANGELOG entry and also a test?
"Fix segfault with #[pyclass(dict, unsendable)]
is probably good enough message
e63f652
to
50a26a8
Compare
I keep forgetting about the changelog! Thanks for the reminder. The amended commit has a (hopefully correct) test case and the changelog entry. |
Offsets for dict and weakref are calculated from the end of the PyCell struct. When using the non-dummy ThreadChecker, the offsets were invalid since the `ThreadCheckerImpl` is not zero-sized.
50a26a8
to
e75f768
Compare
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.
Looks great, many thanks for this!
@sebpuetz Thanks! |
👍 apologies for going too fast here! |
Since there's still some life in here: It probably would be nice to add an in-line comment on |
I think it's difficult since we don't have the concrete |
Addresses #1022
Changing the order doesn't seem to cause any other issues. If changing the order seems risky, we can also calculate the initial offsets based on
offset -= std::mem::size_of::<T::ThreadChecker>() as isize;
Offsets for dict and weakref are calculated from the end of the PyCell struct. When using the non-dummy ThreadChecker, the offsets were invalid since the
ThreadCheckerImpl
is not zero-sized.Thank you for contributing to pyo3!
Here are some things you should check for submitting your pull request:
cargo fmt
(This is checked by travis ci)cargo clippy
and check there are no hard errors (There are a bunch of existing warnings; This is also checked by travis)black .
. You can install black withpip install black
)You might want to run
tox
(pip install tox
) locally to check compatibility with all supported python versions. If you're using linux or mac you might find the Makefile helpful for testing.