You can define it in a header file you include or directly with
distutils Extension(..., define_macros=[("NPY_NO_DEPRECATED_API",
None)]) or when compiling (e.g. passing -D NPY_NO_DEPRECATED_API to
gcc).
> parcel.c: In function ‘__pyx_pf_6parcel_17SimpleParcelModel___init__’:
> parcel.c:2851:10: warning: ‘__pyx_v_cloud_base_s’ may be used uninitialized
> in this function
> parcel.c:2853:10: warning: ‘__pyx_v_my_tk_init’ may be used uninitialized in
> this function
> parcel.c:2856:10: warning: ‘__pyx_v_cpmix’ may be used uninitialized in this
> function
> parcel.c:2873:10: warning: ‘__pyx_v_dtk’ may be used uninitialized in this
> function
> parcel.c:2877:10: warning: ‘__pyx_v_da’ may be used uninitialized in this
> function
> I am quite sure that I am handling these properly. They are initialized
> based on a few if-blocks. Is there a compiler directive to ignore these
> messages?
No, there's not. Could you provide some example code?
- Robert
On Wed, Sep 21, 2011 at 1:27 PM, Gökhan Sever <gokha...@gmail.com> wrote:You can define it in a header file you include or directly with
> Hello,
> I want to be able to suppress the warning shown below:
> In file included from /usr/include/numpy/ndarraytypes.h:1965:0,
> from /usr/include/numpy/ndarrayobject.h:17,
> from /usr/include/numpy/arrayobject.h:14,
> from parcel.c:237:
> /usr/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using
> deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API"
> Where to define this NPY_NO_DEPRECATED_API? I started getting this after
> source compiling a couple days old NumPy.
distutils Extension(..., define_macros=[("NPY_NO_DEPRECATED_API",
None)]) or when compiling (e.g. passing -D NPY_NO_DEPRECATED_API to
gcc).
No, there's not. Could you provide some example code?
> parcel.c: In function ‘__pyx_pf_6parcel_17SimpleParcelModel___init__’:
> parcel.c:2851:10: warning: ‘__pyx_v_cloud_base_s’ may be used uninitialized
> in this function
> parcel.c:2853:10: warning: ‘__pyx_v_my_tk_init’ may be used uninitialized in
> this function
> parcel.c:2856:10: warning: ‘__pyx_v_cpmix’ may be used uninitialized in this
> function
> parcel.c:2873:10: warning: ‘__pyx_v_dtk’ may be used uninitialized in this
> function
> parcel.c:2877:10: warning: ‘__pyx_v_da’ may be used uninitialized in this
> function
> I am quite sure that I am handling these properly. They are initialized
> based on a few if-blocks. Is there a compiler directive to ignore these
> messages?
- Robert
Looks like you need to fix Cython to not use the deprecated API or
wait for someone else to do it. Personally, I'm not sure how hard this
would be or how recently the API was deprecated (if it's fairly
recent, we don't want to emit code using the new API and break anyone
using an older NumPy).