Skip to content

Commit babd774

Browse files
committed
use numpy 1.18.1
1 parent f1d6bdb commit babd774

18 files changed

+2847
-853
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
setup(name='stl_tools',
1313
version='0.4.0',
1414
install_requires=[
15-
'numpy==1.19.5',
15+
'numpy==1.18.1',
1616
'scipy',
1717
'matplotlib'],
1818
description="Generate STL files from numpy arrays and text",

stl_tools/cwrapped.c

Lines changed: 2408 additions & 655 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stl_tools/numpy_include/numpy/__multiarray_api.h

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ NPY_NO_EXPORT void PyArray_FillObjectArray \
221221
NPY_NO_EXPORT int PyArray_FillWithScalar \
222222
(PyArrayObject *, PyObject *);
223223
NPY_NO_EXPORT npy_bool PyArray_CheckStrides \
224-
(int, int, npy_intp, npy_intp, npy_intp const *, npy_intp const *);
224+
(int, int, npy_intp, npy_intp, npy_intp *, npy_intp *);
225225
NPY_NO_EXPORT PyArray_Descr * PyArray_DescrNewByteorder \
226226
(PyArray_Descr *, char);
227227
NPY_NO_EXPORT PyObject * PyArray_IterAllButAxis \
@@ -245,7 +245,7 @@ NPY_NO_EXPORT PyObject * PyArray_NewFlagsObject \
245245
NPY_NO_EXPORT npy_bool PyArray_CanCastScalar \
246246
(PyTypeObject *, PyTypeObject *);
247247
NPY_NO_EXPORT int PyArray_CompareUCS4 \
248-
(npy_ucs4 const *, npy_ucs4 const *, size_t);
248+
(npy_ucs4 *, npy_ucs4 *, size_t);
249249
NPY_NO_EXPORT int PyArray_RemoveSmallest \
250250
(PyArrayMultiIterObject *);
251251
NPY_NO_EXPORT int PyArray_ElementStrides \
@@ -403,9 +403,9 @@ NPY_NO_EXPORT int PyArray_RegisterCanCast \
403403
NPY_NO_EXPORT void PyArray_InitArrFuncs \
404404
(PyArray_ArrFuncs *);
405405
NPY_NO_EXPORT PyObject * PyArray_IntTupleFromIntp \
406-
(int, npy_intp const *);
406+
(int, npy_intp *);
407407
NPY_NO_EXPORT int PyArray_TypeNumFromName \
408-
(char const *);
408+
(char *);
409409
NPY_NO_EXPORT int PyArray_ClipmodeConverter \
410410
(PyObject *, NPY_CLIPMODE *);
411411
NPY_NO_EXPORT int PyArray_OutputConverter \
@@ -425,7 +425,7 @@ NPY_NO_EXPORT int PyArray_SearchsideConverter \
425425
NPY_NO_EXPORT PyObject * PyArray_CheckAxis \
426426
(PyArrayObject *, int *, int);
427427
NPY_NO_EXPORT npy_intp PyArray_OverflowMultiplyList \
428-
(npy_intp const *, int);
428+
(npy_intp *, int);
429429
NPY_NO_EXPORT int PyArray_CompareString \
430430
(const char *, const char *, size_t);
431431
NPY_NO_EXPORT PyObject* PyArray_MultiIterFromObjects \
@@ -873,7 +873,7 @@ static void **PyArray_API=NULL;
873873
(*(int (*)(PyArrayObject *, PyObject *)) \
874874
PyArray_API[104])
875875
#define PyArray_CheckStrides \
876-
(*(npy_bool (*)(int, int, npy_intp, npy_intp, npy_intp const *, npy_intp const *)) \
876+
(*(npy_bool (*)(int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)) \
877877
PyArray_API[105])
878878
#define PyArray_DescrNewByteorder \
879879
(*(PyArray_Descr * (*)(PyArray_Descr *, char)) \
@@ -909,7 +909,7 @@ static void **PyArray_API=NULL;
909909
(*(npy_bool (*)(PyTypeObject *, PyTypeObject *)) \
910910
PyArray_API[116])
911911
#define PyArray_CompareUCS4 \
912-
(*(int (*)(npy_ucs4 const *, npy_ucs4 const *, size_t)) \
912+
(*(int (*)(npy_ucs4 *, npy_ucs4 *, size_t)) \
913913
PyArray_API[117])
914914
#define PyArray_RemoveSmallest \
915915
(*(int (*)(PyArrayMultiIterObject *)) \
@@ -1146,10 +1146,10 @@ static void **PyArray_API=NULL;
11461146
(*(void (*)(PyArray_ArrFuncs *)) \
11471147
PyArray_API[195])
11481148
#define PyArray_IntTupleFromIntp \
1149-
(*(PyObject * (*)(int, npy_intp const *)) \
1149+
(*(PyObject * (*)(int, npy_intp *)) \
11501150
PyArray_API[196])
11511151
#define PyArray_TypeNumFromName \
1152-
(*(int (*)(char const *)) \
1152+
(*(int (*)(char *)) \
11531153
PyArray_API[197])
11541154
#define PyArray_ClipmodeConverter \
11551155
(*(int (*)(PyObject *, NPY_CLIPMODE *)) \
@@ -1179,7 +1179,7 @@ static void **PyArray_API=NULL;
11791179
(*(PyObject * (*)(PyArrayObject *, int *, int)) \
11801180
PyArray_API[206])
11811181
#define PyArray_OverflowMultiplyList \
1182-
(*(npy_intp (*)(npy_intp const *, int)) \
1182+
(*(npy_intp (*)(npy_intp *, int)) \
11831183
PyArray_API[207])
11841184
#define PyArray_CompareString \
11851185
(*(int (*)(const char *, const char *, size_t)) \
@@ -1476,12 +1476,21 @@ _import_array(void)
14761476
return -1;
14771477
}
14781478

1479+
#if PY_VERSION_HEX >= 0x03000000
14791480
if (!PyCapsule_CheckExact(c_api)) {
14801481
PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCapsule object");
14811482
Py_DECREF(c_api);
14821483
return -1;
14831484
}
14841485
PyArray_API = (void **)PyCapsule_GetPointer(c_api, NULL);
1486+
#else
1487+
if (!PyCObject_Check(c_api)) {
1488+
PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is not PyCObject object");
1489+
Py_DECREF(c_api);
1490+
return -1;
1491+
}
1492+
PyArray_API = (void **)PyCObject_AsVoidPtr(c_api);
1493+
#endif
14851494
Py_DECREF(c_api);
14861495
if (PyArray_API == NULL) {
14871496
PyErr_SetString(PyExc_RuntimeError, "_ARRAY_API is NULL pointer");
@@ -1528,7 +1537,13 @@ _import_array(void)
15281537
return 0;
15291538
}
15301539

1531-
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
1540+
#if PY_VERSION_HEX >= 0x03000000
1541+
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
1542+
#else
1543+
#define NUMPY_IMPORT_ARRAY_RETVAL
1544+
#endif
1545+
1546+
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
15321547

15331548
#define import_array1(ret) {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return ret; } }
15341549

stl_tools/numpy_include/numpy/__ufunc_api.h

Lines changed: 70 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@ NPY_NO_EXPORT int PyUFunc_RegisterLoopForType \
1212
NPY_NO_EXPORT int PyUFunc_GenericFunction \
1313
(PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **);
1414
NPY_NO_EXPORT void PyUFunc_f_f_As_d_d \
15-
(char **, npy_intp const *, npy_intp const *, void *);
15+
(char **, npy_intp *, npy_intp *, void *);
1616
NPY_NO_EXPORT void PyUFunc_d_d \
17-
(char **, npy_intp const *, npy_intp const *, void *);
17+
(char **, npy_intp *, npy_intp *, void *);
1818
NPY_NO_EXPORT void PyUFunc_f_f \
19-
(char **, npy_intp const *, npy_intp const *, void *);
19+
(char **, npy_intp *, npy_intp *, void *);
2020
NPY_NO_EXPORT void PyUFunc_g_g \
21-
(char **, npy_intp const *, npy_intp const *, void *);
21+
(char **, npy_intp *, npy_intp *, void *);
2222
NPY_NO_EXPORT void PyUFunc_F_F_As_D_D \
23-
(char **, npy_intp const *, npy_intp const *, void *);
23+
(char **, npy_intp *, npy_intp *, void *);
2424
NPY_NO_EXPORT void PyUFunc_F_F \
25-
(char **, npy_intp const *, npy_intp const *, void *);
25+
(char **, npy_intp *, npy_intp *, void *);
2626
NPY_NO_EXPORT void PyUFunc_D_D \
27-
(char **, npy_intp const *, npy_intp const *, void *);
27+
(char **, npy_intp *, npy_intp *, void *);
2828
NPY_NO_EXPORT void PyUFunc_G_G \
29-
(char **, npy_intp const *, npy_intp const *, void *);
29+
(char **, npy_intp *, npy_intp *, void *);
3030
NPY_NO_EXPORT void PyUFunc_O_O \
31-
(char **, npy_intp const *, npy_intp const *, void *);
31+
(char **, npy_intp *, npy_intp *, void *);
3232
NPY_NO_EXPORT void PyUFunc_ff_f_As_dd_d \
33-
(char **, npy_intp const *, npy_intp const *, void *);
33+
(char **, npy_intp *, npy_intp *, void *);
3434
NPY_NO_EXPORT void PyUFunc_ff_f \
35-
(char **, npy_intp const *, npy_intp const *, void *);
35+
(char **, npy_intp *, npy_intp *, void *);
3636
NPY_NO_EXPORT void PyUFunc_dd_d \
37-
(char **, npy_intp const *, npy_intp const *, void *);
37+
(char **, npy_intp *, npy_intp *, void *);
3838
NPY_NO_EXPORT void PyUFunc_gg_g \
39-
(char **, npy_intp const *, npy_intp const *, void *);
39+
(char **, npy_intp *, npy_intp *, void *);
4040
NPY_NO_EXPORT void PyUFunc_FF_F_As_DD_D \
41-
(char **, npy_intp const *, npy_intp const *, void *);
41+
(char **, npy_intp *, npy_intp *, void *);
4242
NPY_NO_EXPORT void PyUFunc_DD_D \
43-
(char **, npy_intp const *, npy_intp const *, void *);
43+
(char **, npy_intp *, npy_intp *, void *);
4444
NPY_NO_EXPORT void PyUFunc_FF_F \
45-
(char **, npy_intp const *, npy_intp const *, void *);
45+
(char **, npy_intp *, npy_intp *, void *);
4646
NPY_NO_EXPORT void PyUFunc_GG_G \
47-
(char **, npy_intp const *, npy_intp const *, void *);
47+
(char **, npy_intp *, npy_intp *, void *);
4848
NPY_NO_EXPORT void PyUFunc_OO_O \
49-
(char **, npy_intp const *, npy_intp const *, void *);
49+
(char **, npy_intp *, npy_intp *, void *);
5050
NPY_NO_EXPORT void PyUFunc_O_O_method \
51-
(char **, npy_intp const *, npy_intp const *, void *);
51+
(char **, npy_intp *, npy_intp *, void *);
5252
NPY_NO_EXPORT void PyUFunc_OO_O_method \
53-
(char **, npy_intp const *, npy_intp const *, void *);
53+
(char **, npy_intp *, npy_intp *, void *);
5454
NPY_NO_EXPORT void PyUFunc_On_Om \
55-
(char **, npy_intp const *, npy_intp const *, void *);
55+
(char **, npy_intp *, npy_intp *, void *);
5656
NPY_NO_EXPORT int PyUFunc_GetPyValues \
5757
(char *, int *, int *, PyObject **);
5858
NPY_NO_EXPORT int PyUFunc_checkfperr \
@@ -70,17 +70,17 @@ NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignature \
7070
NPY_NO_EXPORT int PyUFunc_SetUsesArraysAsData \
7171
(void **, size_t);
7272
NPY_NO_EXPORT void PyUFunc_e_e \
73-
(char **, npy_intp const *, npy_intp const *, void *);
73+
(char **, npy_intp *, npy_intp *, void *);
7474
NPY_NO_EXPORT void PyUFunc_e_e_As_f_f \
75-
(char **, npy_intp const *, npy_intp const *, void *);
75+
(char **, npy_intp *, npy_intp *, void *);
7676
NPY_NO_EXPORT void PyUFunc_e_e_As_d_d \
77-
(char **, npy_intp const *, npy_intp const *, void *);
77+
(char **, npy_intp *, npy_intp *, void *);
7878
NPY_NO_EXPORT void PyUFunc_ee_e \
79-
(char **, npy_intp const *, npy_intp const *, void *);
79+
(char **, npy_intp *, npy_intp *, void *);
8080
NPY_NO_EXPORT void PyUFunc_ee_e_As_ff_f \
81-
(char **, npy_intp const *, npy_intp const *, void *);
81+
(char **, npy_intp *, npy_intp *, void *);
8282
NPY_NO_EXPORT void PyUFunc_ee_e_As_dd_d \
83-
(char **, npy_intp const *, npy_intp const *, void *);
83+
(char **, npy_intp *, npy_intp *, void *);
8484
NPY_NO_EXPORT int PyUFunc_DefaultTypeResolver \
8585
(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **);
8686
NPY_NO_EXPORT int PyUFunc_ValidateCasting \
@@ -117,67 +117,67 @@ static void **PyUFunc_API=NULL;
117117
(*(int (*)(PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **)) \
118118
PyUFunc_API[3])
119119
#define PyUFunc_f_f_As_d_d \
120-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
120+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
121121
PyUFunc_API[4])
122122
#define PyUFunc_d_d \
123-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
123+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
124124
PyUFunc_API[5])
125125
#define PyUFunc_f_f \
126-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
126+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
127127
PyUFunc_API[6])
128128
#define PyUFunc_g_g \
129-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
129+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
130130
PyUFunc_API[7])
131131
#define PyUFunc_F_F_As_D_D \
132-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
132+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
133133
PyUFunc_API[8])
134134
#define PyUFunc_F_F \
135-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
135+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
136136
PyUFunc_API[9])
137137
#define PyUFunc_D_D \
138-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
138+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
139139
PyUFunc_API[10])
140140
#define PyUFunc_G_G \
141-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
141+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
142142
PyUFunc_API[11])
143143
#define PyUFunc_O_O \
144-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
144+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
145145
PyUFunc_API[12])
146146
#define PyUFunc_ff_f_As_dd_d \
147-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
147+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
148148
PyUFunc_API[13])
149149
#define PyUFunc_ff_f \
150-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
150+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
151151
PyUFunc_API[14])
152152
#define PyUFunc_dd_d \
153-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
153+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
154154
PyUFunc_API[15])
155155
#define PyUFunc_gg_g \
156-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
156+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
157157
PyUFunc_API[16])
158158
#define PyUFunc_FF_F_As_DD_D \
159-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
159+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
160160
PyUFunc_API[17])
161161
#define PyUFunc_DD_D \
162-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
162+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
163163
PyUFunc_API[18])
164164
#define PyUFunc_FF_F \
165-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
165+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
166166
PyUFunc_API[19])
167167
#define PyUFunc_GG_G \
168-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
168+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
169169
PyUFunc_API[20])
170170
#define PyUFunc_OO_O \
171-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
171+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
172172
PyUFunc_API[21])
173173
#define PyUFunc_O_O_method \
174-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
174+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
175175
PyUFunc_API[22])
176176
#define PyUFunc_OO_O_method \
177-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
177+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
178178
PyUFunc_API[23])
179179
#define PyUFunc_On_Om \
180-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
180+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
181181
PyUFunc_API[24])
182182
#define PyUFunc_GetPyValues \
183183
(*(int (*)(char *, int *, int *, PyObject **)) \
@@ -204,22 +204,22 @@ static void **PyUFunc_API=NULL;
204204
(*(int (*)(void **, size_t)) \
205205
PyUFunc_API[32])
206206
#define PyUFunc_e_e \
207-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
207+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
208208
PyUFunc_API[33])
209209
#define PyUFunc_e_e_As_f_f \
210-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
210+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
211211
PyUFunc_API[34])
212212
#define PyUFunc_e_e_As_d_d \
213-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
213+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
214214
PyUFunc_API[35])
215215
#define PyUFunc_ee_e \
216-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
216+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
217217
PyUFunc_API[36])
218218
#define PyUFunc_ee_e_As_ff_f \
219-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
219+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
220220
PyUFunc_API[37])
221221
#define PyUFunc_ee_e_As_dd_d \
222-
(*(void (*)(char **, npy_intp const *, npy_intp const *, void *)) \
222+
(*(void (*)(char **, npy_intp *, npy_intp *, void *)) \
223223
PyUFunc_API[38])
224224
#define PyUFunc_DefaultTypeResolver \
225225
(*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **)) \
@@ -252,12 +252,21 @@ _import_umath(void)
252252
return -1;
253253
}
254254

255+
#if PY_VERSION_HEX >= 0x03000000
255256
if (!PyCapsule_CheckExact(c_api)) {
256257
PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCapsule object");
257258
Py_DECREF(c_api);
258259
return -1;
259260
}
260261
PyUFunc_API = (void **)PyCapsule_GetPointer(c_api, NULL);
262+
#else
263+
if (!PyCObject_Check(c_api)) {
264+
PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCObject object");
265+
Py_DECREF(c_api);
266+
return -1;
267+
}
268+
PyUFunc_API = (void **)PyCObject_AsVoidPtr(c_api);
269+
#endif
261270
Py_DECREF(c_api);
262271
if (PyUFunc_API == NULL) {
263272
PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is NULL pointer");
@@ -266,14 +275,20 @@ _import_umath(void)
266275
return 0;
267276
}
268277

278+
#if PY_VERSION_HEX >= 0x03000000
279+
#define NUMPY_IMPORT_UMATH_RETVAL NULL
280+
#else
281+
#define NUMPY_IMPORT_UMATH_RETVAL
282+
#endif
283+
269284
#define import_umath() \
270285
do {\
271286
UFUNC_NOFPE\
272287
if (_import_umath() < 0) {\
273288
PyErr_Print();\
274289
PyErr_SetString(PyExc_ImportError,\
275290
"numpy.core.umath failed to import");\
276-
return NULL;\
291+
return NUMPY_IMPORT_UMATH_RETVAL;\
277292
}\
278293
} while(0)
279294

stl_tools/numpy_include/numpy/arrayscalars.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,7 @@ typedef struct {
135135
} PyScalarObject;
136136

137137
#define PyStringScalarObject PyStringObject
138-
#define PyStringScalarObject PyStringObject
139-
typedef struct {
140-
/* note that the PyObject_HEAD macro lives right here */
141-
PyUnicodeObject base;
142-
Py_UCS4 *obval;
143-
} PyUnicodeScalarObject;
144-
138+
#define PyUnicodeScalarObject PyUnicodeObject
145139

146140
typedef struct {
147141
PyObject_VAR_HEAD

0 commit comments

Comments
 (0)