[Numpy-discussion] PY_ARRAY_UNIQUE_SYMBOL is too far reaching?

Hans Meine meine at informatik.uni-hamburg.de
Thu May 6 04:21:24 EDT 2010


Am Donnerstag 06 Mai 2010 08:10:35 schrieb Austin Bingham:
> Suppose I defined neither macro in my 'util.h', and that I included
> 'arrayobject.h'. If a user of my library did this:
> 
>   #include <mylib/util.h> // <-- my library's header
> 
>   #define PY_ARRAY_UNIQUE_SYMBOL MY_UNIQUE_SYMBOL
>   #define NO_IMPORT
>   #include <numpy/arrayobject.h>
> 
>   ...
> 
> they'd likely crash.

Really?  Wouldn't it be really easy to check for this situation, i.e. augment 
the inclusion guards by some "if included before, but 
PY_ARRAY_UNIQUE_SYMBOL/NO_IMPORT settings are different than the last time, 
fail and tell the user about it"?

At least that would give a compile error at an earlier point in time.

HTH,
  Hans



More information about the NumPy-Discussion mailing list