Skip to content
This repository
Browse code

API and ABI changes: Removed BigArrayType, Fixed hasobject to an inte…

…ger (and inserted an unused character for alignment) and renamed it to flags. Re-organized the ArrFuncs structure. Moved NPY_DATETIME and friends to their 'correct' place in the type order.
  • Loading branch information...
commit 20ec480ff8979fce00ab076ef74893815bf88f4e 1 parent 29efc30
Travis Oliphant authored
6 doc/CAPI.txt
@@ -61,9 +61,9 @@ This is a very flexible function.
61 61
62 62 ``subtype`` : ``PyTypeObject *``
63 63 The subtype that should be created (either pass in
64   - ``&PyArray_Type``, ``&PyBigArray_Type``, or ``obj->ob_type``,
  64 + ``&PyArray_Type``, or ``obj->ob_type``,
65 65 where ``obj`` is a an instance of a subtype (or subclass) of
66   - ``PyArray_Type`` or ``PyBigArray_Type``).
  66 + ``PyArray_Type``).
67 67
68 68 ``descr`` : ``PyArray_Descr *``
69 69 The type descriptor for the array. This is a Python object (this
@@ -114,7 +114,7 @@ This is a very flexible function.
114 114 order array. See below for an explanation of the flags.
115 115
116 116 ``obj`` : ``PyObject *``
117   - If subtypes is ``&PyArray_Type`` or ``&PyBigArray_Type``, this argument is
  117 + If subtypes is ``&PyArray_Type``, this argument is
118 118 ignored. Otherwise, the ``__array_finalize__`` method of the subtype
119 119 is called (if present) and passed this object. This is usually an
120 120 array of the type to be created (so the ``__array_finalize__`` method
3  doc/cython/c_numpy.pxd
@@ -76,7 +76,8 @@ cdef extern from "numpy/arrayobject.h":
76 76
77 77 ctypedef extern class numpy.dtype [object PyArray_Descr]:
78 78 cdef int type_num, elsize, alignment
79   - cdef char type, kind, byteorder, hasobject
  79 + cdef char type, kind, byteorder
  80 + cdef int flags
80 81 cdef object fields, typeobj
81 82
82 83 ctypedef extern class numpy.ndarray [object PyArrayObject]:
16 doc/numpybook/capi.lyx
@@ -599,7 +599,15 @@ char
599 599 \emph on
600 600 char
601 601 \emph default
602   - hasobject;
  602 + unused;
  603 +\end_layout
  604 +
  605 +\begin_layout LyX-Code
  606 +
  607 +\emph on
  608 +int
  609 +\emph default
  610 + flags;
603 611 \end_layout
604 612
605 613 \begin_layout LyX-Code
@@ -674,9 +682,9 @@ NPY_USE_SETITEM
674 682 \family default
675 683 flags should be set in the
676 684 \family typewriter
677   -hasobject
  685 +flags
678 686 \family default
679   - flag.
  687 + member.
680 688 \end_layout
681 689
682 690 \begin_layout Description
@@ -702,7 +710,7 @@ ndian), '=' (native), '|' (irrelevant, ignore).
702 710 \end_layout
703 711
704 712 \begin_layout Description
705   -hasobject A data-type bit-flag that determines if the data-type exhibits
  713 +flags A data-type bit-flag that determines if the data-type exhibits
706 714 object-array like behavior.
707 715 Each bit in this member is a flag which are named as:
708 716 \end_layout
3  doc/numpybook/comparison/pyrex/c_numpy.pxd
@@ -73,7 +73,8 @@ cdef extern from "numpy/arrayobject.h":
73 73
74 74 ctypedef extern class numpy.dtype [object PyArray_Descr]:
75 75 cdef int type_num, elsize, alignment
76   - cdef char type, kind, byteorder, hasobject
  76 + cdef char type, kind, byteorder
  77 + cdef int flags
77 78 cdef object fields, typeobj
78 79
79 80 ctypedef extern class numpy.ndarray [object PyArrayObject]:
3  doc/pyrex/c_numpy.pxd
@@ -75,7 +75,8 @@ cdef extern from "numpy/arrayobject.h":
75 75
76 76 ctypedef extern class numpy.dtype [object PyArray_Descr]:
77 77 cdef int type_num, elsize, alignment
78   - cdef char type, kind, byteorder, hasobject
  78 + cdef char type, kind, byteorder
  79 + cdef int flags
79 80 cdef object fields, typeobj
80 81
81 82 ctypedef extern class numpy.ndarray [object PyArrayObject]:
7 doc/source/reference/c-api.types-and-structures.rst
Source Rendered
@@ -191,7 +191,8 @@ PyArrayDescr_Type
191 191 char kind;
192 192 char type;
193 193 char byteorder;
194   - char hasobject;
  194 + char unused;
  195 + int flags;
195 196 int type_num;
196 197 int elsize;
197 198 int alignment;
@@ -208,7 +209,7 @@ PyArrayDescr_Type
208 209 should point to a user-defined typeobject. This typeobject can
209 210 either inherit from array scalars or not. If it does not inherit
210 211 from array scalars, then the :cdata:`NPY_USE_GETITEM` and
211   - :cdata:`NPY_USE_SETITEM` flags should be set in the ``hasobject`` flag.
  212 + :cdata:`NPY_USE_SETITEM` flags should be set in the ``flags`` member.
212 213
213 214 .. cmember:: char PyArray_Descr.kind
214 215
@@ -229,7 +230,7 @@ PyArrayDescr_Type
229 230 endian), '=' (native), '\|' (irrelevant, ignore). All builtin data-
230 231 types have byteorder '='.
231 232
232   -.. cmember:: char PyArray_Descr.hasobject
  233 +.. cmember:: int PyArray_Descr.flags
233 234
234 235 A data-type bit-flag that determines if the data-type exhibits object-
235 236 array like behavior. Each bit in this member is a flag which are named
1  numpy/core/code_generators/cversions.txt
@@ -5,3 +5,4 @@
5 5 # Starting from here, the hash is defined from numpy_api.full_api dict
6 6 # version 4 added neighborhood iterators and PyArray_Correlate2
7 7 0x00000004 = 3d8940bf7b0d2a4e25be4338c14c3c85
  8 +0x00000005 = 77e2e846db87f25d7cf99f9d812076f0
449 numpy/core/code_generators/numpy_api.py
@@ -13,7 +13,7 @@
13 13 """
14 14
15 15 multiarray_global_vars = {
16   - 'NPY_NUMUSERTYPES': 7,
  16 + 'NPY_NUMUSERTYPES': 6,
17 17 }
18 18
19 19 multiarray_global_vars_types = {
@@ -21,239 +21,236 @@
21 21 }
22 22
23 23 multiarray_scalar_bool_values = {
24   - '_PyArrayScalar_BoolValues': 9
  24 + '_PyArrayScalar_BoolValues': 8
25 25 }
26 26
27 27 multiarray_types_api = {
28   - 'PyBigArray_Type': 1,
29   - 'PyArray_Type': 2,
30   - 'PyArrayDescr_Type': 3,
31   - 'PyArrayFlags_Type': 4,
32   - 'PyArrayIter_Type': 5,
33   - 'PyArrayMultiIter_Type': 6,
34   - 'PyBoolArrType_Type': 8,
35   - 'PyGenericArrType_Type': 10,
36   - 'PyNumberArrType_Type': 11,
37   - 'PyIntegerArrType_Type': 12,
38   - 'PySignedIntegerArrType_Type': 13,
39   - 'PyUnsignedIntegerArrType_Type': 14,
40   - 'PyInexactArrType_Type': 15,
41   - 'PyFloatingArrType_Type': 16,
42   - 'PyComplexFloatingArrType_Type': 17,
43   - 'PyFlexibleArrType_Type': 18,
44   - 'PyCharacterArrType_Type': 19,
45   - 'PyByteArrType_Type': 20,
46   - 'PyShortArrType_Type': 21,
47   - 'PyIntArrType_Type': 22,
48   - 'PyLongArrType_Type': 23,
49   - 'PyLongLongArrType_Type': 24,
50   - 'PyUByteArrType_Type': 25,
51   - 'PyUShortArrType_Type': 26,
52   - 'PyUIntArrType_Type': 27,
53   - 'PyULongArrType_Type': 28,
54   - 'PyULongLongArrType_Type': 29,
55   - 'PyFloatArrType_Type': 30,
56   - 'PyDoubleArrType_Type': 31,
57   - 'PyLongDoubleArrType_Type': 32,
58   - 'PyCFloatArrType_Type': 33,
59   - 'PyCDoubleArrType_Type': 34,
60   - 'PyCLongDoubleArrType_Type': 35,
61   - 'PyObjectArrType_Type': 36,
62   - 'PyStringArrType_Type': 37,
63   - 'PyUnicodeArrType_Type': 38,
64   - 'PyVoidArrType_Type': 39,
65   -# Those were added much later, and there is no space anymore between Void and
66   -# first functions from multiarray API
67   - 'PyTimeIntegerArrType_Type': 215,
68   - 'PyDatetimeArrType_Type': 216,
69   - 'PyTimedeltaArrType_Type': 217,
  28 + 'PyArray_Type': 1,
  29 + 'PyArrayDescr_Type': 2,
  30 + 'PyArrayFlags_Type': 3,
  31 + 'PyArrayIter_Type': 4,
  32 + 'PyArrayMultiIter_Type': 5,
  33 + 'PyBoolArrType_Type': 7,
  34 + 'PyGenericArrType_Type': 9,
  35 + 'PyNumberArrType_Type': 10,
  36 + 'PyIntegerArrType_Type': 11,
  37 + 'PySignedIntegerArrType_Type': 12,
  38 + 'PyUnsignedIntegerArrType_Type': 13,
  39 + 'PyInexactArrType_Type': 14,
  40 + 'PyFloatingArrType_Type': 15,
  41 + 'PyComplexFloatingArrType_Type': 16,
  42 + 'PyFlexibleArrType_Type': 17,
  43 + 'PyCharacterArrType_Type': 18,
  44 + 'PyByteArrType_Type': 19,
  45 + 'PyShortArrType_Type': 20,
  46 + 'PyIntArrType_Type': 21,
  47 + 'PyLongArrType_Type': 22,
  48 + 'PyLongLongArrType_Type': 23,
  49 + 'PyUByteArrType_Type': 24,
  50 + 'PyUShortArrType_Type': 25,
  51 + 'PyUIntArrType_Type': 26,
  52 + 'PyULongArrType_Type': 27,
  53 + 'PyULongLongArrType_Type': 28,
  54 + 'PyFloatArrType_Type': 29,
  55 + 'PyDoubleArrType_Type': 30,
  56 + 'PyLongDoubleArrType_Type': 31,
  57 + 'PyCFloatArrType_Type': 32,
  58 + 'PyCDoubleArrType_Type': 33,
  59 + 'PyCLongDoubleArrType_Type': 34,
  60 + 'PyObjectArrType_Type': 35,
  61 + 'PyStringArrType_Type': 36,
  62 + 'PyUnicodeArrType_Type': 37,
  63 + 'PyVoidArrType_Type': 38,
  64 + 'PyTimeIntegerArrType_Type': 39,
  65 + 'PyDatetimeArrType_Type': 40,
  66 + 'PyTimedeltaArrType_Type': 41,
70 67 }
71 68
72   -#define NPY_NUMUSERTYPES (*(int *)PyArray_API[7])
73   -#define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[8])
74   -#define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[9])
  69 +#define NPY_NUMUSERTYPES (*(int *)PyArray_API[6])
  70 +#define PyBoolArrType_Type (*(PyTypeObject *)PyArray_API[7])
  71 +#define _PyArrayScalar_BoolValues ((PyBoolScalarObject *)PyArray_API[8])
75 72
76 73 multiarray_funcs_api = {
77 74 'PyArray_GetNDArrayCVersion': 0,
78   - 'PyArray_SetNumericOps': 40,
79   - 'PyArray_GetNumericOps': 41,
80   - 'PyArray_INCREF': 42,
81   - 'PyArray_XDECREF': 43,
82   - 'PyArray_SetStringFunction': 44,
83   - 'PyArray_DescrFromType': 45,
84   - 'PyArray_TypeObjectFromType': 46,
85   - 'PyArray_Zero': 47,
86   - 'PyArray_One': 48,
87   - 'PyArray_CastToType': 49,
88   - 'PyArray_CastTo': 50,
89   - 'PyArray_CastAnyTo': 51,
90   - 'PyArray_CanCastSafely': 52,
91   - 'PyArray_CanCastTo': 53,
92   - 'PyArray_ObjectType': 54,
93   - 'PyArray_DescrFromObject': 55,
94   - 'PyArray_ConvertToCommonType': 56,
95   - 'PyArray_DescrFromScalar': 57,
96   - 'PyArray_DescrFromTypeObject': 58,
97   - 'PyArray_Size': 59,
98   - 'PyArray_Scalar': 60,
99   - 'PyArray_FromScalar': 61,
100   - 'PyArray_ScalarAsCtype': 62,
101   - 'PyArray_CastScalarToCtype': 63,
102   - 'PyArray_CastScalarDirect': 64,
103   - 'PyArray_ScalarFromObject': 65,
104   - 'PyArray_GetCastFunc': 66,
105   - 'PyArray_FromDims': 67,
106   - 'PyArray_FromDimsAndDataAndDescr': 68,
107   - 'PyArray_FromAny': 69,
108   - 'PyArray_EnsureArray': 70,
109   - 'PyArray_EnsureAnyArray': 71,
110   - 'PyArray_FromFile': 72,
111   - 'PyArray_FromString': 73,
112   - 'PyArray_FromBuffer': 74,
113   - 'PyArray_FromIter': 75,
114   - 'PyArray_Return': 76,
115   - 'PyArray_GetField': 77,
116   - 'PyArray_SetField': 78,
117   - 'PyArray_Byteswap': 79,
118   - 'PyArray_Resize': 80,
119   - 'PyArray_MoveInto': 81,
120   - 'PyArray_CopyInto': 82,
121   - 'PyArray_CopyAnyInto': 83,
122   - 'PyArray_CopyObject': 84,
123   - 'PyArray_NewCopy': 85,
124   - 'PyArray_ToList': 86,
125   - 'PyArray_ToString': 87,
126   - 'PyArray_ToFile': 88,
127   - 'PyArray_Dump': 89,
128   - 'PyArray_Dumps': 90,
129   - 'PyArray_ValidType': 91,
130   - 'PyArray_UpdateFlags': 92,
131   - 'PyArray_New': 93,
132   - 'PyArray_NewFromDescr': 94,
133   - 'PyArray_DescrNew': 95,
134   - 'PyArray_DescrNewFromType': 96,
135   - 'PyArray_GetPriority': 97,
136   - 'PyArray_IterNew': 98,
137   - 'PyArray_MultiIterNew': 99,
138   - 'PyArray_PyIntAsInt': 100,
139   - 'PyArray_PyIntAsIntp': 101,
140   - 'PyArray_Broadcast': 102,
141   - 'PyArray_FillObjectArray': 103,
142   - 'PyArray_FillWithScalar': 104,
143   - 'PyArray_CheckStrides': 105,
144   - 'PyArray_DescrNewByteorder': 106,
145   - 'PyArray_IterAllButAxis': 107,
146   - 'PyArray_CheckFromAny': 108,
147   - 'PyArray_FromArray': 109,
148   - 'PyArray_FromInterface': 110,
149   - 'PyArray_FromStructInterface': 111,
150   - 'PyArray_FromArrayAttr': 112,
151   - 'PyArray_ScalarKind': 113,
152   - 'PyArray_CanCoerceScalar': 114,
153   - 'PyArray_NewFlagsObject': 115,
154   - 'PyArray_CanCastScalar': 116,
155   - 'PyArray_CompareUCS4': 117,
156   - 'PyArray_RemoveSmallest': 118,
157   - 'PyArray_ElementStrides': 119,
158   - 'PyArray_Item_INCREF': 120,
159   - 'PyArray_Item_XDECREF': 121,
160   - 'PyArray_FieldNames': 122,
161   - 'PyArray_Transpose': 123,
162   - 'PyArray_TakeFrom': 124,
163   - 'PyArray_PutTo': 125,
164   - 'PyArray_PutMask': 126,
165   - 'PyArray_Repeat': 127,
166   - 'PyArray_Choose': 128,
167   - 'PyArray_Sort': 129,
168   - 'PyArray_ArgSort': 130,
169   - 'PyArray_SearchSorted': 131,
170   - 'PyArray_ArgMax': 132,
171   - 'PyArray_ArgMin': 133,
172   - 'PyArray_Reshape': 134,
173   - 'PyArray_Newshape': 135,
174   - 'PyArray_Squeeze': 136,
175   - 'PyArray_View': 137,
176   - 'PyArray_SwapAxes': 138,
177   - 'PyArray_Max': 139,
178   - 'PyArray_Min': 140,
179   - 'PyArray_Ptp': 141,
180   - 'PyArray_Mean': 142,
181   - 'PyArray_Trace': 143,
182   - 'PyArray_Diagonal': 144,
183   - 'PyArray_Clip': 145,
184   - 'PyArray_Conjugate': 146,
185   - 'PyArray_Nonzero': 147,
186   - 'PyArray_Std': 148,
187   - 'PyArray_Sum': 149,
188   - 'PyArray_CumSum': 150,
189   - 'PyArray_Prod': 151,
190   - 'PyArray_CumProd': 152,
191   - 'PyArray_All': 153,
192   - 'PyArray_Any': 154,
193   - 'PyArray_Compress': 155,
194   - 'PyArray_Flatten': 156,
195   - 'PyArray_Ravel': 157,
196   - 'PyArray_MultiplyList': 158,
197   - 'PyArray_MultiplyIntList': 159,
198   - 'PyArray_GetPtr': 160,
199   - 'PyArray_CompareLists': 161,
200   - 'PyArray_AsCArray': 162,
201   - 'PyArray_As1D': 163,
202   - 'PyArray_As2D': 164,
203   - 'PyArray_Free': 165,
204   - 'PyArray_Converter': 166,
205   - 'PyArray_IntpFromSequence': 167,
206   - 'PyArray_Concatenate': 168,
207   - 'PyArray_InnerProduct': 169,
208   - 'PyArray_MatrixProduct': 170,
209   - 'PyArray_CopyAndTranspose': 171,
210   - 'PyArray_Correlate': 172,
211   - 'PyArray_TypestrConvert': 173,
212   - 'PyArray_DescrConverter': 174,
213   - 'PyArray_DescrConverter2': 175,
214   - 'PyArray_IntpConverter': 176,
215   - 'PyArray_BufferConverter': 177,
216   - 'PyArray_AxisConverter': 178,
217   - 'PyArray_BoolConverter': 179,
218   - 'PyArray_ByteorderConverter': 180,
219   - 'PyArray_OrderConverter': 181,
220   - 'PyArray_EquivTypes': 182,
221   - 'PyArray_Zeros': 183,
222   - 'PyArray_Empty': 184,
223   - 'PyArray_Where': 185,
224   - 'PyArray_Arange': 186,
225   - 'PyArray_ArangeObj': 187,
226   - 'PyArray_SortkindConverter': 188,
227   - 'PyArray_LexSort': 189,
228   - 'PyArray_Round': 190,
229   - 'PyArray_EquivTypenums': 191,
230   - 'PyArray_RegisterDataType': 192,
231   - 'PyArray_RegisterCastFunc': 193,
232   - 'PyArray_RegisterCanCast': 194,
233   - 'PyArray_InitArrFuncs': 195,
234   - 'PyArray_IntTupleFromIntp': 196,
235   - 'PyArray_TypeNumFromName': 197,
236   - 'PyArray_ClipmodeConverter': 198,
237   - 'PyArray_OutputConverter': 199,
238   - 'PyArray_BroadcastToShape': 200,
239   - '_PyArray_SigintHandler': 201,
240   - '_PyArray_GetSigintBuf': 202,
241   - 'PyArray_DescrAlignConverter': 203,
242   - 'PyArray_DescrAlignConverter2': 204,
243   - 'PyArray_SearchsideConverter': 205,
244   - 'PyArray_CheckAxis': 206,
245   - 'PyArray_OverflowMultiplyList': 207,
246   - 'PyArray_CompareString': 208,
247   - 'PyArray_MultiIterFromObjects': 209,
248   - 'PyArray_GetEndianness': 210,
249   - 'PyArray_GetNDArrayCFeatureVersion': 211,
250   - 'PyArray_Correlate2': 212,
251   - 'PyArray_NeighborhoodIterNew': 213,
252   - 'PyArray_SetDatetimeParseFunction': 214,
253   - 'PyArray_DatetimeToDatetimeStruct': 218,
254   - 'PyArray_TimedeltaToTimedeltaStruct': 219,
255   - 'PyArray_DatetimeStructToDatetime': 220,
256   - 'PyArray_TimedeltaStructToTimedelta': 221,
  75 + 'PyArray_SetNumericOps': 42,
  76 + 'PyArray_GetNumericOps': 43,
  77 + 'PyArray_INCREF': 44,
  78 + 'PyArray_XDECREF': 45,
  79 + 'PyArray_SetStringFunction': 46,
  80 + 'PyArray_DescrFromType': 47,
  81 + 'PyArray_TypeObjectFromType': 48,
  82 + 'PyArray_Zero': 49,
  83 + 'PyArray_One': 50,
  84 + 'PyArray_CastToType': 51,
  85 + 'PyArray_CastTo': 52,
  86 + 'PyArray_CastAnyTo': 53,
  87 + 'PyArray_CanCastSafely': 54,
  88 + 'PyArray_CanCastTo': 55,
  89 + 'PyArray_ObjectType': 56,
  90 + 'PyArray_DescrFromObject': 57,
  91 + 'PyArray_ConvertToCommonType': 58,
  92 + 'PyArray_DescrFromScalar': 59,
  93 + 'PyArray_DescrFromTypeObject': 60,
  94 + 'PyArray_Size': 61,
  95 + 'PyArray_Scalar': 62,
  96 + 'PyArray_FromScalar': 63,
  97 + 'PyArray_ScalarAsCtype': 64,
  98 + 'PyArray_CastScalarToCtype': 65,
  99 + 'PyArray_CastScalarDirect': 66,
  100 + 'PyArray_ScalarFromObject': 67,
  101 + 'PyArray_GetCastFunc': 68,
  102 + 'PyArray_FromDims': 69,
  103 + 'PyArray_FromDimsAndDataAndDescr': 70,
  104 + 'PyArray_FromAny': 71,
  105 + 'PyArray_EnsureArray': 72,
  106 + 'PyArray_EnsureAnyArray': 73,
  107 + 'PyArray_FromFile': 74,
  108 + 'PyArray_FromString': 75,
  109 + 'PyArray_FromBuffer': 76,
  110 + 'PyArray_FromIter': 77,
  111 + 'PyArray_Return': 78,
  112 + 'PyArray_GetField': 79,
  113 + 'PyArray_SetField': 80,
  114 + 'PyArray_Byteswap': 81,
  115 + 'PyArray_Resize': 82,
  116 + 'PyArray_MoveInto': 83,
  117 + 'PyArray_CopyInto': 84,
  118 + 'PyArray_CopyAnyInto': 85,
  119 + 'PyArray_CopyObject': 86,
  120 + 'PyArray_NewCopy': 87,
  121 + 'PyArray_ToList': 88,
  122 + 'PyArray_ToString': 89,
  123 + 'PyArray_ToFile': 90,
  124 + 'PyArray_Dump': 91,
  125 + 'PyArray_Dumps': 92,
  126 + 'PyArray_ValidType': 93,
  127 + 'PyArray_UpdateFlags': 94,
  128 + 'PyArray_New': 95,
  129 + 'PyArray_NewFromDescr': 96,
  130 + 'PyArray_DescrNew': 97,
  131 + 'PyArray_DescrNewFromType': 98,
  132 + 'PyArray_GetPriority': 99,
  133 + 'PyArray_IterNew': 100,
  134 + 'PyArray_MultiIterNew': 101,
  135 + 'PyArray_PyIntAsInt': 102,
  136 + 'PyArray_PyIntAsIntp': 103,
  137 + 'PyArray_Broadcast': 104,
  138 + 'PyArray_FillObjectArray': 105,
  139 + 'PyArray_FillWithScalar': 106,
  140 + 'PyArray_CheckStrides': 107,
  141 + 'PyArray_DescrNewByteorder': 108,
  142 + 'PyArray_IterAllButAxis': 109,
  143 + 'PyArray_CheckFromAny': 110,
  144 + 'PyArray_FromArray': 111,
  145 + 'PyArray_FromInterface': 112,
  146 + 'PyArray_FromStructInterface': 113,
  147 + 'PyArray_FromArrayAttr': 114,
  148 + 'PyArray_ScalarKind': 115,
  149 + 'PyArray_CanCoerceScalar': 116,
  150 + 'PyArray_NewFlagsObject': 117,
  151 + 'PyArray_CanCastScalar': 118,
  152 + 'PyArray_CompareUCS4': 119,
  153 + 'PyArray_RemoveSmallest': 120,
  154 + 'PyArray_ElementStrides': 121,
  155 + 'PyArray_Item_INCREF': 122,
  156 + 'PyArray_Item_XDECREF': 123,
  157 + 'PyArray_FieldNames': 124,
  158 + 'PyArray_Transpose': 125,
  159 + 'PyArray_TakeFrom': 126,
  160 + 'PyArray_PutTo': 127,
  161 + 'PyArray_PutMask': 128,
  162 + 'PyArray_Repeat': 129,
  163 + 'PyArray_Choose': 130,
  164 + 'PyArray_Sort': 131,
  165 + 'PyArray_ArgSort': 132,
  166 + 'PyArray_SearchSorted': 133,
  167 + 'PyArray_ArgMax': 134,
  168 + 'PyArray_ArgMin': 135,
  169 + 'PyArray_Reshape': 136,
  170 + 'PyArray_Newshape': 137,
  171 + 'PyArray_Squeeze': 138,
  172 + 'PyArray_View': 139,
  173 + 'PyArray_SwapAxes': 140,
  174 + 'PyArray_Max': 141,
  175 + 'PyArray_Min': 142,
  176 + 'PyArray_Ptp': 143,
  177 + 'PyArray_Mean': 144,
  178 + 'PyArray_Trace': 145,
  179 + 'PyArray_Diagonal': 146,
  180 + 'PyArray_Clip': 147,
  181 + 'PyArray_Conjugate': 148,
  182 + 'PyArray_Nonzero': 149,
  183 + 'PyArray_Std': 150,
  184 + 'PyArray_Sum': 151,
  185 + 'PyArray_CumSum': 152,
  186 + 'PyArray_Prod': 153,
  187 + 'PyArray_CumProd': 154,
  188 + 'PyArray_All': 155,
  189 + 'PyArray_Any': 156,
  190 + 'PyArray_Compress': 157,
  191 + 'PyArray_Flatten': 158,
  192 + 'PyArray_Ravel': 159,
  193 + 'PyArray_MultiplyList': 160,
  194 + 'PyArray_MultiplyIntList': 161,
  195 + 'PyArray_GetPtr': 162,
  196 + 'PyArray_CompareLists': 163,
  197 + 'PyArray_AsCArray': 164,
  198 + 'PyArray_As1D': 165,
  199 + 'PyArray_As2D': 166,
  200 + 'PyArray_Free': 167,
  201 + 'PyArray_Converter': 168,
  202 + 'PyArray_IntpFromSequence': 169,
  203 + 'PyArray_Concatenate': 170,
  204 + 'PyArray_InnerProduct': 171,
  205 + 'PyArray_MatrixProduct': 172,
  206 + 'PyArray_CopyAndTranspose': 173,
  207 + 'PyArray_Correlate': 174,
  208 + 'PyArray_TypestrConvert': 175,
  209 + 'PyArray_DescrConverter': 176,
  210 + 'PyArray_DescrConverter2': 177,
  211 + 'PyArray_IntpConverter': 178,
  212 + 'PyArray_BufferConverter': 179,
  213 + 'PyArray_AxisConverter': 180,
  214 + 'PyArray_BoolConverter': 181,
  215 + 'PyArray_ByteorderConverter': 182,
  216 + 'PyArray_OrderConverter': 183,
  217 + 'PyArray_EquivTypes': 184,
  218 + 'PyArray_Zeros': 185,
  219 + 'PyArray_Empty': 186,
  220 + 'PyArray_Where': 187,
  221 + 'PyArray_Arange': 188,
  222 + 'PyArray_ArangeObj': 189,
  223 + 'PyArray_SortkindConverter': 190,
  224 + 'PyArray_LexSort': 191,
  225 + 'PyArray_Round': 192,
  226 + 'PyArray_EquivTypenums': 193,
  227 + 'PyArray_RegisterDataType': 194,
  228 + 'PyArray_RegisterCastFunc': 195,
  229 + 'PyArray_RegisterCanCast': 196,
  230 + 'PyArray_InitArrFuncs': 197,
  231 + 'PyArray_IntTupleFromIntp': 198,
  232 + 'PyArray_TypeNumFromName': 199,
  233 + 'PyArray_ClipmodeConverter': 200,
  234 + 'PyArray_OutputConverter': 201,
  235 + 'PyArray_BroadcastToShape': 202,
  236 + '_PyArray_SigintHandler': 203,
  237 + '_PyArray_GetSigintBuf': 204,
  238 + 'PyArray_DescrAlignConverter': 205,
  239 + 'PyArray_DescrAlignConverter2': 206,
  240 + 'PyArray_SearchsideConverter': 207,
  241 + 'PyArray_CheckAxis': 208,
  242 + 'PyArray_OverflowMultiplyList': 209,
  243 + 'PyArray_CompareString': 210,
  244 + 'PyArray_MultiIterFromObjects': 211,
  245 + 'PyArray_GetEndianness': 212,
  246 + 'PyArray_GetNDArrayCFeatureVersion': 213,
  247 + 'PyArray_Correlate2': 214,
  248 + 'PyArray_NeighborhoodIterNew': 215,
  249 + 'PyArray_SetDatetimeParseFunction': 216,
  250 + 'PyArray_DatetimeToDatetimeStruct': 217,
  251 + 'PyArray_TimedeltaToTimedeltaStruct': 218,
  252 + 'PyArray_DatetimeStructToDatetime': 219,
  253 + 'PyArray_TimedeltaStructToTimedelta': 220,
257 254 }
258 255
259 256 ufunc_types_api = {
28 numpy/core/include/numpy/ndarrayobject.h
@@ -75,10 +75,10 @@ enum NPY_TYPES { NPY_BOOL=0,
75 75 NPY_LONGLONG, NPY_ULONGLONG,
76 76 NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE,
77 77 NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE,
78   - NPY_OBJECT=17,
  78 + NPY_DATETIME, NPY_TIMEDELTA,
  79 + NPY_OBJECT=19,
79 80 NPY_STRING, NPY_UNICODE,
80 81 NPY_VOID,
81   - NPY_DATETIME, NPY_TIMEDELTA,
82 82 NPY_NTYPES,
83 83 NPY_NOTYPE,
84 84 NPY_CHAR, /* special flag */
@@ -381,10 +381,6 @@ typedef struct {
381 381 } PyArray_Dims;
382 382
383 383 typedef struct {
384   - /* Functions to cast to all other standard types*/
385   - /* Can have some NULL entries */
386   - PyArray_VectorUnaryFunc *cast[NPY_NTYPES];
387   -
388 384 /* The next four functions *cannot* be NULL */
389 385
390 386 /* Functions to get and set items with standard
@@ -453,6 +449,17 @@ typedef struct {
453 449 PyArray_FastClipFunc *fastclip;
454 450 PyArray_FastPutmaskFunc *fastputmask;
455 451 PyArray_FastTakeFunc *fasttake;
  452 +
  453 + /* A little room to grow --- should use generic function interface for most additions */
  454 + void *pad1;
  455 + void *pad2;
  456 + void *pad3;
  457 + void *pad4;
  458 +
  459 + /* Functions to cast to all other standard types*/
  460 + /* Can have some NULL entries */
  461 + PyArray_VectorUnaryFunc *cast[NPY_NTYPES];
  462 +
456 463 } PyArray_ArrFuncs;
457 464
458 465 /* The item must be reference counted when it is inserted or extracted. */
@@ -483,12 +490,11 @@ typedef struct {
483 490 NPY_NEEDS_INIT | NPY_NEEDS_PYAPI)
484 491
485 492 #define PyDataType_FLAGCHK(dtype, flag) \
486   - (((dtype)->hasobject & (flag)) == (flag))
  493 + (((dtype)->flags & (flag)) == (flag))
487 494
488 495 #define PyDataType_REFCHK(dtype) \
489 496 PyDataType_FLAGCHK(dtype, NPY_ITEM_REFCOUNT)
490 497
491   -/* Change dtype hasobject to 32-bit in 1.1 and change its name */
492 498 typedef struct _PyArray_Descr {
493 499 PyObject_HEAD
494 500 PyTypeObject *typeobj; /* the type object representing an
@@ -499,9 +505,9 @@ typedef struct _PyArray_Descr {
499 505 char type; /* unique-character representing this type */
500 506 char byteorder; /* '>' (big), '<' (little), '|'
501 507 (not-applicable), or '=' (native). */
502   - char hasobject; /* non-zero if it has object arrays
503   - in fields */
504   - int type_num; /* number representing this type */
  508 + char unused;
  509 + int flags; /* flag describing data type */
  510 + int type_num; /* number representing this type */
505 511 int elsize; /* element size for this type */
506 512 int alignment; /* alignment needed for this type */
507 513 struct _arr_descr \
4 numpy/core/setup_common.py
@@ -21,7 +21,7 @@
21 21 # Binary compatibility version number. This number is increased whenever the
22 22 # C-API is changed such that binary compatibility is broken, i.e. whenever a
23 23 # recompile of extension modules is needed.
24   -C_ABI_VERSION = 0x01000009
  24 +C_ABI_VERSION = 0x02000000
25 25
26 26 # Minor API version. This number is increased whenever a change is made to the
27 27 # C-API -- whether it breaks binary compatibility or not. Some changes, such
@@ -29,7 +29,7 @@
29 29 # without breaking binary compatibility. In this case, only the C_API_VERSION
30 30 # (*not* C_ABI_VERSION) would be increased. Whenever binary compatibility is
31 31 # broken, both C_API_VERSION and C_ABI_VERSION should be increased.
32   -C_API_VERSION = 0x00000004
  32 +C_API_VERSION = 0x00000005
33 33
34 34 class MismatchCAPIWarning(Warning):
35 35 pass
112 numpy/core/src/multiarray/arraytypes.c.src
@@ -3312,31 +3312,6 @@ static int
3312 3312 * #endian = |, |, =#
3313 3313 */
3314 3314 static PyArray_ArrFuncs _Py@NAME@_ArrFuncs = {
3315   - {
3316   - (PyArray_VectorUnaryFunc*)@from@_to_BOOL,
3317   - (PyArray_VectorUnaryFunc*)@from@_to_BYTE,
3318   - (PyArray_VectorUnaryFunc*)@from@_to_UBYTE,
3319   - (PyArray_VectorUnaryFunc*)@from@_to_SHORT,
3320   - (PyArray_VectorUnaryFunc*)@from@_to_USHORT,
3321   - (PyArray_VectorUnaryFunc*)@from@_to_INT,
3322   - (PyArray_VectorUnaryFunc*)@from@_to_UINT,
3323   - (PyArray_VectorUnaryFunc*)@from@_to_LONG,
3324   - (PyArray_VectorUnaryFunc*)@from@_to_ULONG,
3325   - (PyArray_VectorUnaryFunc*)@from@_to_LONGLONG,
3326   - (PyArray_VectorUnaryFunc*)@from@_to_ULONGLONG,
3327   - (PyArray_VectorUnaryFunc*)@from@_to_FLOAT,
3328   - (PyArray_VectorUnaryFunc*)@from@_to_DOUBLE,
3329   - (PyArray_VectorUnaryFunc*)@from@_to_LONGDOUBLE,
3330   - (PyArray_VectorUnaryFunc*)@from@_to_CFLOAT,
3331   - (PyArray_VectorUnaryFunc*)@from@_to_CDOUBLE,
3332   - (PyArray_VectorUnaryFunc*)@from@_to_CLONGDOUBLE,
3333   - (PyArray_VectorUnaryFunc*)@from@_to_OBJECT,
3334   - (PyArray_VectorUnaryFunc*)@from@_to_STRING,
3335   - (PyArray_VectorUnaryFunc*)@from@_to_UNICODE,
3336   - (PyArray_VectorUnaryFunc*)@from@_to_VOID,
3337   - (PyArray_VectorUnaryFunc*)@from@_to_DATETIME,
3338   - (PyArray_VectorUnaryFunc*)@from@_to_TIMEDELTA
3339   - },
3340 3315 (PyArray_GetItemFunc*)@from@_getitem,
3341 3316 (PyArray_SetItemFunc*)@from@_setitem,
3342 3317 (PyArray_CopySwapNFunc*)@from@_copyswapn,
@@ -3361,7 +3336,33 @@ static PyArray_ArrFuncs _Py@NAME@_ArrFuncs = {
3361 3336 NULL,
3362 3337 (PyArray_FastClipFunc *)NULL,
3363 3338 (PyArray_FastPutmaskFunc *)NULL,
3364   - (PyArray_FastTakeFunc *)NULL
  3339 + (PyArray_FastTakeFunc *)NULL,
  3340 + NULL, NULL, NULL, NULL,
  3341 + {
  3342 + (PyArray_VectorUnaryFunc*)@from@_to_BOOL,
  3343 + (PyArray_VectorUnaryFunc*)@from@_to_BYTE,
  3344 + (PyArray_VectorUnaryFunc*)@from@_to_UBYTE,
  3345 + (PyArray_VectorUnaryFunc*)@from@_to_SHORT,
  3346 + (PyArray_VectorUnaryFunc*)@from@_to_USHORT,
  3347 + (PyArray_VectorUnaryFunc*)@from@_to_INT,
  3348 + (PyArray_VectorUnaryFunc*)@from@_to_UINT,
  3349 + (PyArray_VectorUnaryFunc*)@from@_to_LONG,
  3350 + (PyArray_VectorUnaryFunc*)@from@_to_ULONG,
  3351 + (PyArray_VectorUnaryFunc*)@from@_to_LONGLONG,
  3352 + (PyArray_VectorUnaryFunc*)@from@_to_ULONGLONG,
  3353 + (PyArray_VectorUnaryFunc*)@from@_to_FLOAT,
  3354 + (PyArray_VectorUnaryFunc*)@from@_to_DOUBLE,
  3355 + (PyArray_VectorUnaryFunc*)@from@_to_LONGDOUBLE,
  3356 + (PyArray_VectorUnaryFunc*)@from@_to_CFLOAT,
  3357 + (PyArray_VectorUnaryFunc*)@from@_to_CDOUBLE,
  3358 + (PyArray_VectorUnaryFunc*)@from@_to_CLONGDOUBLE,
  3359 + (PyArray_VectorUnaryFunc*)@from@_to_DATETIME,
  3360 + (PyArray_VectorUnaryFunc*)@from@_to_TIMEDELTA,
  3361 + (PyArray_VectorUnaryFunc*)@from@_to_OBJECT,
  3362 + (PyArray_VectorUnaryFunc*)@from@_to_STRING,
  3363 + (PyArray_VectorUnaryFunc*)@from@_to_UNICODE,
  3364 + (PyArray_VectorUnaryFunc*)@from@_to_VOID
  3365 + }
3365 3366 };
3366 3367
3367 3368 /*
@@ -3374,6 +3375,7 @@ static PyArray_Descr @from@_Descr = {
3374 3375 PyArray_@from@LTR,
3375 3376 '@endian@',
3376 3377 0,
  3378 + 0,
3377 3379 PyArray_@from@,
3378 3380 0,
3379 3381 _ALIGN(@align@),
@@ -3406,31 +3408,6 @@ static PyArray_Descr @from@_Descr = {
3406 3408 * #isobject= 0*17,NPY_OBJECT_DTYPE_FLAGS,0*2#
3407 3409 */
3408 3410 static PyArray_ArrFuncs _Py@NAME@_ArrFuncs = {
3409   - {
3410   - (PyArray_VectorUnaryFunc*)@from@_to_BOOL,
3411   - (PyArray_VectorUnaryFunc*)@from@_to_BYTE,
3412   - (PyArray_VectorUnaryFunc*)@from@_to_UBYTE,
3413   - (PyArray_VectorUnaryFunc*)@from@_to_SHORT,
3414   - (PyArray_VectorUnaryFunc*)@from@_to_USHORT,
3415   - (PyArray_VectorUnaryFunc*)@from@_to_INT,
3416   - (PyArray_VectorUnaryFunc*)@from@_to_UINT,
3417   - (PyArray_VectorUnaryFunc*)@from@_to_LONG,
3418   - (PyArray_VectorUnaryFunc*)@from@_to_ULONG,
3419   - (PyArray_VectorUnaryFunc*)@from@_to_LONGLONG,
3420   - (PyArray_VectorUnaryFunc*)@from@_to_ULONGLONG,
3421   - (PyArray_VectorUnaryFunc*)@from@_to_FLOAT,
3422   - (PyArray_VectorUnaryFunc*)@from@_to_DOUBLE,
3423   - (PyArray_VectorUnaryFunc*)@from@_to_LONGDOUBLE,
3424   - (PyArray_VectorUnaryFunc*)@from@_to_CFLOAT,
3425   - (PyArray_VectorUnaryFunc*)@from@_to_CDOUBLE,
3426   - (PyArray_VectorUnaryFunc*)@from@_to_CLONGDOUBLE,
3427   - (PyArray_VectorUnaryFunc*)@from@_to_OBJECT,
3428   - (PyArray_VectorUnaryFunc*)@from@_to_STRING,
3429   - (PyArray_VectorUnaryFunc*)@from@_to_UNICODE,
3430   - (PyArray_VectorUnaryFunc*)@from@_to_VOID,
3431   - (PyArray_VectorUnaryFunc*)@from@_to_DATETIME,
3432   - (PyArray_VectorUnaryFunc*)@from@_to_TIMEDELTA
3433   - },
3434 3411 (PyArray_GetItemFunc*)@from@_getitem,
3435 3412 (PyArray_SetItemFunc*)@from@_setitem,
3436 3413 (PyArray_CopySwapNFunc*)@from@_copyswapn,
@@ -3455,7 +3432,33 @@ static PyArray_ArrFuncs _Py@NAME@_ArrFuncs = {
3455 3432 NULL,
3456 3433 (PyArray_FastClipFunc*)@from@_fastclip,
3457 3434 (PyArray_FastPutmaskFunc*)@from@_fastputmask,
3458   - (PyArray_FastTakeFunc*)@from@_fasttake
  3435 + (PyArray_FastTakeFunc*)@from@_fasttake,
  3436 + NULL, NULL, NULL, NULL,
  3437 + {
  3438 + (PyArray_VectorUnaryFunc*)@from@_to_BOOL,
  3439 + (PyArray_VectorUnaryFunc*)@from@_to_BYTE,
  3440 + (PyArray_VectorUnaryFunc*)@from@_to_UBYTE,
  3441 + (PyArray_VectorUnaryFunc*)@from@_to_SHORT,
  3442 + (PyArray_VectorUnaryFunc*)@from@_to_USHORT,
  3443 + (PyArray_VectorUnaryFunc*)@from@_to_INT,
  3444 + (PyArray_VectorUnaryFunc*)@from@_to_UINT,
  3445 + (PyArray_VectorUnaryFunc*)@from@_to_LONG,
  3446 + (PyArray_VectorUnaryFunc*)@from@_to_ULONG,
  3447 + (PyArray_VectorUnaryFunc*)@from@_to_LONGLONG,
  3448 + (PyArray_VectorUnaryFunc*)@from@_to_ULONGLONG,
  3449 + (PyArray_VectorUnaryFunc*)@from@_to_FLOAT,
  3450 + (PyArray_VectorUnaryFunc*)@from@_to_DOUBLE,
  3451 + (PyArray_VectorUnaryFunc*)@from@_to_LONGDOUBLE,
  3452 + (PyArray_VectorUnaryFunc*)@from@_to_CFLOAT,
  3453 + (PyArray_VectorUnaryFunc*)@from@_to_CDOUBLE,
  3454 + (PyArray_VectorUnaryFunc*)@from@_to_CLONGDOUBLE,
  3455 + (PyArray_VectorUnaryFunc*)@from@_to_OBJECT,
  3456 + (PyArray_VectorUnaryFunc*)@from@_to_DATETIME,
  3457 + (PyArray_VectorUnaryFunc*)@from@_to_TIMEDELTA,
  3458 + (PyArray_VectorUnaryFunc*)@from@_to_STRING,
  3459 + (PyArray_VectorUnaryFunc*)@from@_to_UNICODE,
  3460 + (PyArray_VectorUnaryFunc*)@from@_to_VOID
  3461 + }
3459 3462 };
3460 3463
3461 3464 /*
@@ -3467,6 +3470,7 @@ NPY_NO_EXPORT PyArray_Descr @from@_Descr = {
3467 3470 PyArray_@kind@LTR,
3468 3471 PyArray_@from@LTR,
3469 3472 '@endian@',
  3473 + 0,
3470 3474 @isobject@,
3471 3475 PyArray_@from@,
3472 3476 @num@*sizeof(@fromtyp@),
@@ -3520,12 +3524,12 @@ static PyArray_Descr *_builtin_descrs[] = {
3520 3524 &CFLOAT_Descr,
3521 3525 &CDOUBLE_Descr,
3522 3526 &CLONGDOUBLE_Descr,
  3527 + &DATETIME_Descr,
  3528 + &TIMEDELTA_Descr,
3523 3529 &OBJECT_Descr,
3524 3530 &STRING_Descr,
3525 3531 &UNICODE_Descr,
3526 3532 &VOID_Descr,
3527   - &DATETIME_Descr,
3528   - &TIMEDELTA_Descr,
3529 3533 };
3530 3534
3531 3535 /*NUMPY_API
33 numpy/core/src/multiarray/descriptor.c
@@ -231,7 +231,7 @@ _convert_from_tuple(PyObject *obj)
231 231 PyDimMem_FREE(shape.ptr);
232 232 newdescr->subarray = _pya_malloc(sizeof(PyArray_ArrayDescr));
233 233 newdescr->subarray->base = type;
234   - newdescr->hasobject = type->hasobject;
  234 + newdescr->flags = type->flags;
235 235 Py_INCREF(val);
236 236 newdescr->subarray->shape = val;
237 237 Py_XDECREF(newdescr->fields);
@@ -356,7 +356,7 @@ _convert_from_array_descr(PyObject *obj, int align)
356 356 "two fields with the same name");
357 357 goto fail;
358 358 }
359   - dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS);
  359 + dtypeflags |= (conv->flags & NPY_FROM_FIELDS);
360 360 tup = PyTuple_New((title == NULL ? 2 : 3));
361 361 PyTuple_SET_ITEM(tup, 0, (PyObject *)conv);
362 362 if (align) {
@@ -402,7 +402,7 @@ _convert_from_array_descr(PyObject *obj, int align)
402 402 new->fields = fields;
403 403 new->names = nameslist;
404 404 new->elsize = totalsize;
405   - new->hasobject=dtypeflags;
  405 + new->flags=dtypeflags;
406 406 if (maxalign > 1) {
407 407 totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign;
408 408 }
@@ -465,7 +465,7 @@ _convert_from_list(PyObject *obj, int align)
465 465 Py_DECREF(key);
466 466 goto fail;
467 467 }
468   - dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS);
  468 + dtypeflags |= (conv->flags & NPY_FROM_FIELDS);
469 469 PyTuple_SET_ITEM(tup, 0, (PyObject *)conv);
470 470 if (align) {
471 471 int _align;
@@ -485,7 +485,7 @@ _convert_from_list(PyObject *obj, int align)
485 485 new = PyArray_DescrNewFromType(PyArray_VOID);
486 486 new->fields = fields;
487 487 new->names = nameslist;
488   - new->hasobject=dtypeflags;
  488 + new->flags=dtypeflags;
489 489 if (maxalign > 1) {
490 490 totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign;
491 491 }
@@ -839,7 +839,7 @@ _use_inherit(PyArray_Descr *type, PyObject *newobj, int *errflag)
839 839 new->names = conv->names;
840 840 Py_XINCREF(new->names);
841 841 }
842   - new->hasobject = conv->hasobject;
  842 + new->flags = conv->flags;
843 843 Py_DECREF(conv);
844 844 *errflag = 0;
845 845 return new;
@@ -1033,7 +1033,7 @@ _convert_from_dict(PyObject *obj, int align)
1033 1033 if ((ret == PY_FAIL) || (newdescr->elsize == 0)) {
1034 1034 goto fail;
1035 1035 }
1036   - dtypeflags |= (newdescr->hasobject & NPY_FROM_FIELDS);
  1036 + dtypeflags |= (newdescr->flags & NPY_FROM_FIELDS);
1037 1037 totalsize += newdescr->elsize;
1038 1038 }
1039 1039
@@ -1056,7 +1056,7 @@ _convert_from_dict(PyObject *obj, int align)
1056 1056 }
1057 1057 new->names = names;
1058 1058 new->fields = fields;
1059   - new->hasobject = dtypeflags;
  1059 + new->flags = dtypeflags;
1060 1060
1061 1061 metadata = PyDict_GetItemString(obj, "metadata");
1062 1062
@@ -1477,7 +1477,7 @@ static PyMemberDef arraydescr_members[] = {
1477 1477 {"alignment",
1478 1478 T_INT, offsetof(PyArray_Descr, alignment), READONLY, NULL},
1479 1479 {"flags",
1480   - T_UBYTE, offsetof(PyArray_Descr, hasobject), READONLY, NULL},
  1480 + T_INT, offsetof(PyArray_Descr, flags), READONLY, NULL},
1481 1481 {NULL, 0, 0, 0, NULL},
1482 1482 };
1483 1483
@@ -2079,7 +2079,7 @@ arraydescr_reduce(PyArray_Descr *self, PyObject *NPY_UNUSED(args))
2079 2079 }
2080 2080 PyTuple_SET_ITEM(state, 5, PyInt_FromLong(elsize));
2081 2081 PyTuple_SET_ITEM(state, 6, PyInt_FromLong(alignment));
2082   - PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->hasobject));
  2082 + PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->flags));
2083 2083
2084 2084 PyTuple_SET_ITEM(ret, 2, state);
2085 2085 return ret;
@@ -2091,7 +2091,7 @@ arraydescr_reduce(PyArray_Descr *self, PyObject *NPY_UNUSED(args))
2091 2091 static int
2092 2092 _descr_find_object(PyArray_Descr *self)
2093 2093 {
2094   - if (self->hasobject || self->type_num == PyArray_OBJECT ||
  2094 + if (self->flags || self->type_num == PyArray_OBJECT ||
2095 2095 self->kind == 'O') {
2096 2096 return NPY_OBJECT_DTYPE_FLAGS;
2097 2097 }
@@ -2110,7 +2110,7 @@ _descr_find_object(PyArray_Descr *self)
2110 2110 return 0;
2111 2111 }
2112 2112 if (_descr_find_object(new)) {
2113   - new->hasobject = NPY_OBJECT_DTYPE_FLAGS;
  2113 + new->flags = NPY_OBJECT_DTYPE_FLAGS;
2114 2114 return NPY_OBJECT_DTYPE_FLAGS;
2115 2115 }
2116 2116 }
@@ -2156,6 +2156,7 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args)
2156 2156 &subarray, &names, &fields, &elsize,
2157 2157 &alignment, &dtypeflags, &metadata)) {
2158 2158 return NULL;
  2159 +#undef _ARGSTR_
2159 2160 }
2160 2161 break;
2161 2162 case 8:
@@ -2168,6 +2169,7 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args)
2168 2169 &subarray, &names, &fields, &elsize,
2169 2170 &alignment, &dtypeflags)) {
2170 2171 return NULL;
  2172 +#undef _ARGSTR_
2171 2173 }
2172 2174 break;
2173 2175 case 7:
@@ -2180,6 +2182,7 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args)
2180 2182 &subarray, &names, &fields, &elsize,
2181 2183 &alignment)) {
2182 2184 return NULL;
  2185 +#undef _ARGSTR_
2183 2186 }
2184 2187 break;
2185 2188 case 6:
@@ -2192,6 +2195,7 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args)
2192 2195 &endian, &subarray, &fields,
2193 2196 &elsize, &alignment)) {
2194 2197 PyErr_Clear();
  2198 +#undef _ARGSTR_
2195 2199 }
2196 2200 break;
2197 2201 case 5:
@@ -2204,6 +2208,7 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args)
2204 2208 if (!PyArg_ParseTuple(args, _ARGSTR_,
2205 2209 &endian, &subarray, &fields, &elsize,
2206 2210 &alignment)) {
  2211 +#undef _ARGSTR_
2207 2212 return NULL;
2208 2213 }
2209 2214 break;
@@ -2289,9 +2294,9 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args)
2289 2294 self->alignment = alignment;
2290 2295 }
2291 2296
2292   - self->hasobject = dtypeflags;
  2297 + self->flags = dtypeflags;
2293 2298 if (version < 3) {
2294   - self->hasobject = _descr_find_object(self);
  2299 + self->flags = _descr_find_object(self);
2295 2300 }
2296 2301
2297 2302 Py_XDECREF(self->metadata);
6 numpy/core/src/multiarray/hashdescr.c
@@ -53,11 +53,11 @@ static int _array_descr_builtin(PyArray_Descr* descr, PyObject *l)
53 53 PyObject *t, *item;
54 54
55 55 /*
56   - * For builtin type, hash relies on : kind + byteorder + hasobject +
  56 + * For builtin type, hash relies on : kind + byteorder + flags +
57 57 * type_num + elsize + alignment
58 58 */
59   - t = Py_BuildValue("(ccciii)", descr->kind, descr->byteorder,
60   - descr->hasobject, descr->type_num, descr->elsize,
  59 + t = Py_BuildValue("(cciiii)", descr->kind, descr->byteorder,
  60 + descr->flags, descr->type_num, descr->elsize,
61 61 descr->alignment);
62 62
63 63 for(i = 0; i < PyTuple_Size(t); ++i) {
2  numpy/core/src/multiarray/mapping.c
@@ -316,7 +316,7 @@ PyArray_SetMap(PyArrayMapIterObject *mit, PyObject *op)
316 316 (PyArray_ISNOTSWAPPED(arr)));
317 317 copyswap = PyArray_DESCR(arr)->f->copyswap;
318 318 PyArray_MapIterReset(mit);
319   - /* Need to decref hasobject arrays */
  319 + /* Need to decref arrays with objects in them */
320 320 if (PyDataType_FLAGCHK(descr, NPY_ITEM_HASOBJECT)) {
321 321 while (index--) {
322 322 PyArray_Item_INCREF(it->dataptr, PyArray_DESCR(arr));
2  numpy/core/src/multiarray/multiarraymodule.c
@@ -42,8 +42,6 @@ NPY_NO_EXPORT int NPY_NUMUSERTYPES = 0;
42 42 #include "number.h"
43 43 #include "scalartypes.h"
44 44
45   -NPY_NO_EXPORT PyTypeObject PyBigArray_Type;
46   -
47 45 /*NUMPY_API
48 46 * Get Priority from object
49 47 */
2  numpy/random/mtrand/numpy.pxi
@@ -73,7 +73,7 @@ cdef extern from "numpy/arrayobject.h":
73 73
74 74 ctypedef extern class numpy.dtype [object PyArray_Descr]:
75 75 cdef int type_num, elsize, alignment
76   - cdef char type, kind, byteorder, hasobject
  76 + cdef char type, kind, byteorder, flags
77 77 cdef object fields, typeobj
78 78
79 79 ctypedef extern class numpy.ndarray [object PyArrayObject]:

0 comments on commit 20ec480

Please sign in to comment.
Something went wrong with that request. Please try again.