westonpace commented on code in PR #12590:
URL: https://github.com/apache/arrow/pull/12590#discussion_r854548953
##########
cpp/src/arrow/python/common.h:
##########
@@ -180,6 +180,9 @@ class ARROW_PYTHON_EXPORT OwnedRefNoGIL : public OwnedRef {
explicit OwnedRefNoGIL(PyObject* obj) : OwnedRef(obj) {}
~OwnedRefNoGIL() {
+ if (obj() == NULLPTR) {
Review Comment:
This is from the call to `detach`. Concretely we had to make this change to
avoid trying to acquire the GIL during/after finalization (by detecting that we
are finalizing/finalized and detaching in `PythonUdf`).
However, since `OwnedRefNoGIL` is a moveable type, we are probably
encountering this situation already (we detach on move) but getting away with
it because it calls `Py_XDECREF` which tolerates null. So this will hopefully
prevent us from needlessly grabbing the GIL in a few other situations as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]