[Numpy-discussion] Porting to the new C-API (1.7)

Mads Ipsen mads.ipsen at gmail.com
Mon Oct 21 03:20:12 EDT 2013


I've been using the numpy-1.6 C-API as part of a large C++ based OpenGL

The C++ classes are exposed in Python by using SWIG, and utilize numpy
arrays both as inputs to methods and method return values to the Python

To enable numpy in the SWIG generated Python module, the SWIG generated
C++ file define


whereas all other C++ files that need access to the numpy C-API contain

  #include "numpy/arrayobject.h"

I have now updated to numpy-1.7, and receive warnings of the form

#warning "Using deprecated NumPy API, disable it by

This is basically fine with me, and I don't mind doing an update of my
code to the new C-API.

I have a few questions though:

1) Since I am apparently using the old API, where can I find a list of
   the deprecated things I use? That would make the upgrade easier.

2) Do I still have to use the PY_ARRAY_UNIQUE_SYMBOL approach when
   using the new C-API.

3) According to some websites you can do something like


This puzzles me a bit. Is there a doc somewhere where this whole thing
is explained in detail. I must admit, its somewhat hard to grasp
what's going on.

Best regards,


| Mads Ipsen                                          |
| Gåsebæksvej 7, 4. tv |                              |
| DK-2500 Valby        | phone:          +45-29716388 |
| Denmark              | email:  mads.ipsen at gmail.com |

More information about the NumPy-Discussion mailing list