seberg commented on code in PR #48391:
URL: https://github.com/apache/arrow/pull/48391#discussion_r2671792370


##########
python/pyarrow/src/arrow/python/numpy_to_arrow.cc:
##########
@@ -74,6 +77,27 @@ using internal::NumPyTypeSize;
 
 namespace {
 
+#if NPY_ABI_VERSION >= 0x02000000

Review Comment:
   ABI version is the compile time header version of NumPy. 
`NPY_FEATURE_VERSION` is the runtime one you are compiling for.
   I.e. by default API that is only available on newer versions is disabled so 
you can't compile to run with 1.x support but use newer API.
   
   In this particular case (effectively using future API) `#if NPY_ABI_VERSION 
>= 0x02000000` may tell you that a definition is already included in the 
header, in this case I guess `PyArray_StringDTypeObject`.
   There is no reason to hide such a definition, so we don't (the thing to hide 
is mostly API table entries).
   
   Maybe there should be a section on "how to use future API depending on the 
NumPy runtime version" (although for things we really expect it, we may want to 
add it to the `npy2_compat.h` header ourselves instead).
   
   FWIW, I still think it makes most sense to wholesale copy-paste the NumPy 
header definitions. Then add some form of guard (and be it `#if 
NPY_FEATURE_VERSION < NUMPY_2_0_VERSION` or what it was), so that when it is 
exposed by the NumPy headers you stop using it.



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