-
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
Check to see if object is None
before traversing
#2921
Conversation
1bb6edb
to
6259790
Compare
I read through the contributing guide and I think I did the newsfragment correctly. If it isn't right, feel free to either let me know what I did wrong or just do whatever needs to be done to fix it. |
The failed CI jobs do not seem related to my changes, so I don't plan on addressing them. |
Can you add a test? Your example in #2915 should do nicely. You can put it in a test function similar to https://github.com/PyO3/pyo3/pull/2914/files#diff-e28c611e920921574b15af9f361787212c273d1b4327337593639e619176bd6f
That's just because some diagnostics have changed in today's new Rust version. If you rebase after #2922 they should pass. |
Looks good to me, thanks - I think rebasing will fix CI (new rust release). |
@mejrs is right, a test would be appreciated 😂 |
Closes PyO3#2915 When using the C API directly, the intended way to call `visitproc` is via the `Py_VISIT` macro, which checks to see that the provided pointer is not null before passing it along to `visitproc`. Because PyO3 isn't using the macro, it needs to manually check that the pointer isn't null. Without this check, calling `visit.call(&obj)` where `let obj = None;` will segfault.
6259790
to
92c882d
Compare
Rebased and unit test added. |
Since we're just testing a bug during traversal, we don't actually have to reap the object, we just have to make a reference cycle so that it's traverse method is called.
92c882d
to
f11290d
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.
Thanks!
bors r+ |
Build succeeded: |
Closes #2915
When using the C API directly, the intended way to call
visitproc
is via thePy_VISIT
macro, which checks to see that the provided pointer is not null before passing it along tovisitproc
. Because PyO3 isn't using the macro, it needs to manually check that the pointer isn't null. Without this check, callingvisit.call(&obj)
wherelet obj = None;
will segfault.