pitrou commented on code in PR #39314:
URL: https://github.com/apache/arrow/pull/39314#discussion_r1434314783


##########
python/pyarrow/pandas-shim.pxi:
##########
@@ -101,8 +101,10 @@ cdef class _PandasAPIShim(object):
                 self._import_pandas(raise_)
             return
 
-        self._tried_importing_pandas = True
-        self._import_pandas(raise_)
+        try:
+            self._import_pandas(raise_)
+        finally:
+            self._tried_importing_pandas = True

Review Comment:
   Since we're bothered about race conditions, can we use a lock here? 
   ```suggestion
           with self._lock:
               if self._tried_importing_pandas:
                   try:
                       self._import_pandas(raise_)
                   finally:
                       self._tried_importing_pandas = True
   ```



##########
python/pyarrow/pandas-shim.pxi:
##########
@@ -101,8 +101,10 @@ cdef class _PandasAPIShim(object):
                 self._import_pandas(raise_)
             return
 
-        self._tried_importing_pandas = True
-        self._import_pandas(raise_)
+        try:
+            self._import_pandas(raise_)
+        finally:
+            self._tried_importing_pandas = True

Review Comment:
   Since we're bothered about race conditions, can we use a lock here? 
   ```suggestion
           with self._lock:
               if not self._tried_importing_pandas:
                   try:
                       self._import_pandas(raise_)
                   finally:
                       self._tried_importing_pandas = True
   ```



-- 
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]

Reply via email to