-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
MAINT: Minor cleanup to F2PY #20884
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
MAINT: Minor cleanup to F2PY #20884
Conversation
@@ -124,6 +124,10 @@ | |||
#define PY_SSIZE_T_CLEAN | |||
#endif /* PY_SSIZE_T_CLEAN */ | |||
|
|||
/* Unconditionally included */ | |||
#include <Python.h> | |||
#include <numpy/npy_os.h> |
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.
Technically npy_os.h
should only be included if long_long
or unsigned_long_long
or threading is required.
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.
Another option which would also provide quite a bit of clean up is to use #include <numpy/npy_common.h>
(which defines, among other things, Python.h
and npy_os.h
) and remove the typedef
s used by F2PY for say, complex numbers.
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.
In keeping with the original "minor cleanup" spirit of this PR, we will only use npy_os.h
here and defer the larger cleanup w.r.t. npy_common.h
to #21161.
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.
Not the most appropriate person to review, but I can confirm all SciPy tests pass with this change.
I am +0 on this. On the one hand, it does seem to standardize the defines to one place. On the other, the defines are only used in ~1 other place anyway, so the cognitive load to know that they are aliases and to find where they are defined is burdensome. |
Addendum to numpy#20884: fix and deobfuscate Windows OS defines. Specifically, NPY_OS_WIN64 was never defined, as _WIN32 is defined whenever _WIN64 is. Also remove NPY_OS_MINGW, since it also never got defined. Note also that MINGW is not an OS anyway, but a build environment like MSVC. All changes either preserve functionality or restore original intent.
An addendum to numpy#20884 that fixes and deobfuscates Windows OS defines. NPY_OS_WIN64 was never defined, as _WIN32 is defined whenever _WIN64 is. Rename NPY_OS_WIN* constants to be less ambiguous, to avoid future confusion about their meanings. Also remove NPY_OS_MINGW, since it too never got defined. Note that MINGW is not an OS anyway, but a build environment like MSVC. All changes either preserve functionality or restore original intent.
This PR:
numpy
forf2py
Draft since after #20881 is in, some of the checks there (BSD, WIN) can be kanged from
npy_os.h
as well.