Fix headers #2888

merged 7 commits into from Jan 6, 2013


None yet
2 participants

charris commented Jan 5, 2013

This does some maintenance work on the numpy headers. The details are in the commit comments, but generally some rearrangement is done, outdated comments removed, hard tab removal, and such. There are some new unprefixed macros added to the noprefix.h file just in case, and npy_config is fixed so that the macros used are defined and duplicate code removed.

There are some files including config.h directly that also need fixing, but that is deferred to a later PR.

charris added some commits Jan 5, 2013

@charris charris MAINT: Remove unneeded comment form arrayobject.h 699c697
@charris charris MAINT: Remove unneeded include from ndarraytypes.h. cba2994
@charris charris MAINT: Add some macros to noprefix.h
Some of these are probably new unprefixed macros, but adding them
makes for a bit more safety. The unprefixed macros will be deprecated
at some point, so this probably has no side effects.
@charris charris MAINT: Gather NPY_SIZEOF* macros into one spot. d0a54c4
@charris charris MAINT: Remove tabs from numpyconfig.h. e6d6042
@charris charris BUG: Fixup use of undefined macros and remove redundant code.
The npy_config.h file used SIZEOF_DOUBLE and SIZEOF_LONG_DOUBLE, neither
of which was defined in the included config.h file. That was fixed by
including numpyconfig.h. Doing so made the code dealing with Apple type
sizes redundant as it is already present in numpyconfig.h, so it was

njsmith commented Jan 5, 2013

Are unprefixed macros included into user code by default? If so then the newly added SIZEOF_ and BITSOF_ could potentially conflict with and break existing code... though the risk may be low.

Can't see any issues with any of the rest.


charris commented Jan 6, 2013

No, either NPY_NO_PREFIX needs to be defined up top in order to get the unprefixed versions when arrayobject.h is included, or noprefix.h needs to be explicitly imported. And if you do both, you only get the unprefixed versions ;)

But your point is a good one. Should I remove those new macros?


njsmith commented Jan 6, 2013

If it's not too horrible to work out which ones they are, then I think so, yeah. The risk seems small but the benefit is even smaller. Better to be extra-super-careful about the things that don't matter so we can spend our user annoyance budget on changes that are actually worth it ;-)

@charris charris MAINT: Remove newly defined non-prefixed macros from noprefix.h.
There was a chance that they could conflict with user defined macros.

charris commented Jan 6, 2013

@njsmith Done.

njsmith merged commit 22ad3ac into numpy:master Jan 6, 2013

1 check passed

default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment