pyo3/newsfragments/2921.fixed.md
Nate Kent f38841a8e2
Check to see if object is None before traversing
Closes #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.
2023-01-26 15:55:58 -08:00

83 B

Traversal visit calls to Option<T: AsPyPointer> no longer segfaults when None.