Skip to content

Commit 5fa9b70

Browse files
authored
Add missing constant constraints (#594)
1 parent 8585407 commit 5fa9b70

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

code/ndarray.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,25 @@ mp_obj_t ndarray_flatten(size_t , const mp_obj_t *, mp_map_t *);
230230
MP_DECLARE_CONST_FUN_OBJ_KW(ndarray_flatten_obj);
231231
#endif
232232

233+
#if NDARRAY_HAS_DTYPE
233234
mp_obj_t ndarray_dtype(mp_obj_t );
235+
#endif
236+
237+
#if NDARRAY_HAS_ITEMSIZE
234238
mp_obj_t ndarray_itemsize(mp_obj_t );
239+
#endif
240+
241+
#if NDARRAY_HAS_SIZE
235242
mp_obj_t ndarray_size(mp_obj_t );
243+
#endif
244+
245+
#if NDARRAY_HAS_SHAPE
236246
mp_obj_t ndarray_shape(mp_obj_t );
247+
#endif
248+
249+
#if NDARRAY_HAS_STRIDES
237250
mp_obj_t ndarray_strides(mp_obj_t );
251+
#endif
238252

239253
#if NDARRAY_HAS_RESHAPE
240254
mp_obj_t ndarray_reshape_core(mp_obj_t , mp_obj_t , bool );
@@ -247,7 +261,7 @@ mp_obj_t ndarray_tobytes(mp_obj_t );
247261
MP_DECLARE_CONST_FUN_OBJ_1(ndarray_tobytes_obj);
248262
#endif
249263

250-
#if NDARRAY_HAS_TOBYTES
264+
#if NDARRAY_HAS_TOLIST
251265
mp_obj_t ndarray_tolist(mp_obj_t );
252266
MP_DECLARE_CONST_FUN_OBJ_1(ndarray_tolist_obj);
253267
#endif

code/ndarray_properties.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,29 @@ STATIC const mp_obj_property_t ndarray_strides_obj = {
9292

9393
void ndarray_properties_attr(mp_obj_t , qstr , mp_obj_t *);
9494

95+
#if NDARRAY_HAS_DTYPE
9596
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_dtype_obj, ndarray_dtype);
97+
#endif
98+
99+
#if NDARRAY_HAS_FLATITER
96100
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_flatiter_make_new_obj, ndarray_flatiter_make_new);
101+
#endif
102+
103+
#if NDARRAY_HAS_ITEMSIZE
97104
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_itemsize_obj, ndarray_itemsize);
105+
#endif
106+
107+
#if NDARRAY_HAS_SHAPE
98108
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_shape_obj, ndarray_shape);
109+
#endif
110+
111+
#if NDARRAY_HAS_SIZE
99112
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_size_obj, ndarray_size);
113+
#endif
114+
115+
#if NDARRAY_HAS_STRIDES
100116
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_strides_obj, ndarray_strides);
117+
#endif
101118

102119
#endif /* CIRCUITPY */
103120

code/numpy/numerical.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,11 @@ static mp_obj_t numerical_function(size_t n_args, const mp_obj_t *pos_args, mp_m
569569
mp_raise_TypeError(translate("axis must be None, or an integer"));
570570
}
571571

572+
#if ULAB_NUMPY_HAS_ALL | ULAB_NUMPY_HAS_ANY
572573
if((optype == NUMERICAL_ALL) || (optype == NUMERICAL_ANY)) {
573574
return numerical_all_any(oin, axis, optype);
574575
}
576+
#endif
575577
if(mp_obj_is_type(oin, &mp_type_tuple) || mp_obj_is_type(oin, &mp_type_list) ||
576578
mp_obj_is_type(oin, &mp_type_range)) {
577579
switch(optype) {

0 commit comments

Comments
 (0)