[Numpy-discussion] datetime uses API deprecated in python3.1

Pauli Virtanen pav@iki...
Sun Feb 21 12:17:46 CST 2010

su, 2010-02-21 kello 02:13 -0700, Charles R Harris kirjoitti:
> The warning is
> dep.py:6: PendingDeprecationWarning: The CObject API is deprecated as
> of Python 3.1.  Please convert to using the Capsule API.
>   np.dtype('M8[3M/40]')
> This doesn't happen with the old dtypes, so I assume it is associated
> with something introduced for datetime. Any ideas? I've attached a
> script that shows the warning.

The PyCObjects are used at least within the __array_struct__ interface,
ufuncs, and apparently the datetime extra data is stored within one in
the array metadata dict.

The Capsule API seems pretty much the same as the CObject API. (Why the
name change?) We can probably #define PyCapsule_* compatibility defines
in npy_3kcompat.h that use PyCObject on 2.x, and use the real thing on

Pauli Virtanen

More information about the NumPy-Discussion mailing list