{"action":"created","issue":{"url":"https://api.github.com/repos/v923z/micropython-ulab/issues/21","repository_url":"https://api.github.com/repos/v923z/micropython-ulab","labels_url":"https://api.github.com/repos/v923z/micropython-ulab/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/v923z/micropython-ulab/issues/21/comments","events_url":"https://api.github.com/repos/v923z/micropython-ulab/issues/21/events","html_url":"https://github.com/v923z/micropython-ulab/issues/21","id":543606488,"node_id":"MDU6SXNzdWU1NDM2MDY0ODg=","number":21,"title":"building in CircuitPython","user":{"login":"GathererA","id":43546101,"node_id":"MDQ6VXNlcjQzNTQ2MTAx","avatar_url":"https://avatars1.githubusercontent.com/u/43546101?v=4","gravatar_id":"","url":"https://api.github.com/users/GathererA","html_url":"https://github.com/GathererA","followers_url":"https://api.github.com/users/GathererA/followers","following_url":"https://api.github.com/users/GathererA/following{/other_user}","gists_url":"https://api.github.com/users/GathererA/gists{/gist_id}","starred_url":"https://api.github.com/users/GathererA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GathererA/subscriptions","organizations_url":"https://api.github.com/users/GathererA/orgs","repos_url":"https://api.github.com/users/GathererA/repos","events_url":"https://api.github.com/users/GathererA/events{/privacy}","received_events_url":"https://api.github.com/users/GathererA/received_events","type":"User","site_admin":false},"labels":[{"id":1665778766,"node_id":"MDU6TGFiZWwxNjY1Nzc4NzY2","url":"https://api.github.com/repos/v923z/micropython-ulab/labels/compilation","name":"compilation","color":"637bbf","default":false,"description":"compilation failure (most probably mac, or windows)"},{"id":1528269574,"node_id":"MDU6TGFiZWwxNTI4MjY5NTc0","url":"https://api.github.com/repos/v923z/micropython-ulab/labels/enhancement","name":"enhancement","color":"a2eeef","default":true,"description":"New feature or request"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":36,"created_at":"2019-12-29T22:48:13Z","updated_at":"2020-01-04T06:12:50Z","closed_at":null,"author_association":"NONE","body":"This is amazing! I've been trying to build ulab in CircuitPython, which I should be able to do as CP is a fork of micropython, but I've been having a lot of trouble. I'm seeing a lot of issues with shadowed declarations and comparison between signed and unsigned integers. When I attempt to make the board in the appropriate port using:\r\n\r\n`make BOARD=pybadge USER_C_MODULES=../../../ulab all`\r\n\r\nI get the following error:\r\n\r\nIncluding User C Module from ../../../ulab/code\r\nQSTR updated\r\nFREEZE ../../frozen/circuitpython-stage/pybadge\r\n../../../ulab/code/ndarray.c: In function 'ndarray_print_row':\r\n../../../ulab/code/ndarray.c:81:20: error: declaration of 'i' shadows a previous local [-Werror=shadow]\r\n         for(size_t i=1; i<3; i++) {\r\n                    ^\r\n../../../ulab/code/ndarray.c:66:12: note: shadowed declaration is here\r\n     size_t i;\r\n            ^\r\n../../../ulab/code/ndarray.c: In function 'ndarray_make_new':\r\n../../../ulab/code/ndarray.c:168:30: error: passing argument 2 of 'mp_arg_check_num' makes pointer from integer without a cast [-Werror=int-conversion]\r\n     mp_arg_check_num(n_args, n_kw, 1, 2, true);\r\n                              ^~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:80:6: note: expected 'mp_map_t * {aka struct _mp_map_t *}' but argument is of type 'size_t {aka unsigned int}'\r\n void mp_arg_check_num(size_t n_args, mp_map_t *kw_args, size_t n_args_min, size_t n_args_max, bool takes_kw);\r\n      ^~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:176:29: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n         mp_raise_ValueError(\"first argument must be an iterable\");\r\n                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:191:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]\r\n                 if(len2 != MP_OBJ_SMALL_INT_VALUE(len_in)) {\r\n                         ^~\r\n../../../ulab/code/ndarray.c:192:41: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n                     mp_raise_ValueError(\"iterables are not of the same length\");\r\n                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c: In function 'true_length':\r\n../../../ulab/code/ndarray.c:234:13: error: implicit declaration of function 'mp_obj_is_type'; did you mean 'mp_obj_is_true'? [-Werror=implicit-function-declaration]\r\n         if(!mp_obj_is_type(item, &mp_type_bool)) {\r\n             ^~~~~~~~~~~~~~\r\n             mp_obj_is_true\r\n../../../ulab/code/ndarray.c:234:13: error: nested extern declaration of 'mp_obj_is_type' [-Werror=nested-externs]\r\n../../../ulab/code/ndarray.c: In function 'generate_slice':\r\n../../../ulab/code/ndarray.c:251:15: error: implicit declaration of function 'mp_obj_is_int'; did you mean 'mp_obj_list_init'? [-Werror=implicit-function-declaration]\r\n     } else if(mp_obj_is_int(index)) {\r\n               ^~~~~~~~~~~~~\r\n               mp_obj_list_init\r\n../../../ulab/code/ndarray.c:251:15: error: nested extern declaration of 'mp_obj_is_int' [-Werror=nested-externs]\r\n../../../ulab/code/ndarray.c:256:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]\r\n         if((_index >= n) || (_index < 0)) {\r\n                    ^~\r\n../../../ulab/code/ndarray.c:257:47: error: passing argument 2 of 'mp_raise_msg' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n             mp_raise_msg(&mp_type_IndexError, \"index is out of bounds\");\r\n                                               ^~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:151:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:263:43: error: passing argument 2 of 'mp_raise_msg' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n         mp_raise_msg(&mp_type_IndexError, \"indices must be integers, slices, or Boolean lists\");\r\n                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:151:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c: In function 'insert_slice_list':\r\n../../../ulab/code/ndarray.c:293:33: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n             mp_raise_ValueError(\"could not broadast input array from shape\");\r\n                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:355:27: error: declaration of 'cindex' shadows a previous local [-Werror=shadow]\r\n             size_t j = 0, cindex = 0;\r\n                           ^~~~~~\r\n../../../ulab/code/ndarray.c:296:12: note: shadowed declaration is here\r\n     size_t cindex, rindex;\r\n            ^~~~~~\r\n../../../ulab/code/ndarray.c: In function 'iterate_slice_list':\r\n../../../ulab/code/ndarray.c:380:43: error: passing argument 2 of 'mp_raise_msg' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n         mp_raise_msg(&mp_type_IndexError, \"empty index range\");\r\n                                           ^~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:151:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:441:27: error: declaration of 'cindex' shadows a previous local [-Werror=shadow]\r\n             size_t j = 0, cindex = 0;\r\n                           ^~~~~~\r\n../../../ulab/code/ndarray.c:390:12: note: shadowed declaration is here\r\n     size_t cindex, rindex;\r\n            ^~~~~~\r\n../../../ulab/code/ndarray.c: In function 'ndarray_get_slice':\r\n../../../ulab/code/ndarray.c:498:47: error: passing argument 2 of 'mp_raise_msg' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n             mp_raise_msg(&mp_type_IndexError, \"too many indices\");\r\n                                               ^~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:151:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:506:51: error: passing argument 2 of 'mp_raise_msg' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n                 mp_raise_msg(&mp_type_IndexError, \"indices must be integers, slices, or Boolean lists\");\r\n                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:151:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c: In function 'ndarray_subscr':\r\n../../../ulab/code/ndarray.c:547:33: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n             mp_raise_ValueError(\"right hand side must be an ndarray, or a scalar\");\r\n                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c: In function 'ndarray_flatten':\r\n../../../ulab/code/ndarray.c:658:29: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n         mp_raise_ValueError(\"flattening order must be either 'C', or 'F'\");\r\n                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c: In function 'ndarray_binary_op':\r\n../../../ulab/code/ndarray.c:723:33: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n             mp_raise_ValueError(\"operands could not be broadcast together\");\r\n                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:826:40: error: passing argument 1 of 'mp_raise_TypeError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n                     mp_raise_TypeError(\"wrong input type\");\r\n                                        ^~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:155:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_TypeError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:834:28: error: passing argument 1 of 'mp_raise_TypeError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n         mp_raise_TypeError(\"wrong operand type on the right hand side\");\r\n                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:155:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_TypeError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c: In function 'ndarray_unary_op':\r\n../../../ulab/code/ndarray.c:852:37: error: passing argument 1 of 'mp_raise_ValueError' from incompatible pointer type [-Werror=incompatible-pointer-types]\r\n                 mp_raise_ValueError(\"operation is not supported for given type\");\r\n                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\nIn file included from ../../../ulab/code/ndarray.c:15:0:\r\n../../py/runtime.h:153:15: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'\r\n NORETURN void mp_raise_ValueError(const compressed_string_t *msg);\r\n               ^~~~~~~~~~~~~~~~~~~\r\n../../../ulab/code/ndarray.c:865:26: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                          ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:868:25: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 int8_t *array = (int8_t *)ndarray->array->items;\r\n                         ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:871:27: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 uint16_t *array = (uint16_t *)ndarray->array->items;\r\n                           ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:874:26: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 int16_t *array = (int16_t *)ndarray->array->items;\r\n                          ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:877:29: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 mp_float_t *array = (mp_float_t *)ndarray->array->items;\r\n                             ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:892:25: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 int8_t *array = (int8_t *)ndarray->array->items;\r\n                         ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:897:26: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 int16_t *array = (int16_t *)ndarray->array->items;\r\n                          ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\n../../../ulab/code/ndarray.c:902:29: error: declaration of 'array' shadows a previous local [-Werror=shadow]\r\n                 mp_float_t *array = (mp_float_t *)ndarray->array->items;\r\n                             ^~~~~\r\n../../../ulab/code/ndarray.c:857:22: note: shadowed declaration is here\r\n             uint8_t *array = (uint8_t *)ndarray->array->items;\r\n                      ^~~~~\r\ncc1: all warnings being treated as errors\r\nmake: *** [build-pybadge/code/ndarray.o] Error 1\r\n"},"comment":{"url":"https://api.github.com/repos/v923z/micropython-ulab/issues/comments/570760454","html_url":"https://github.com/v923z/micropython-ulab/issues/21#issuecomment-570760454","issue_url":"https://api.github.com/repos/v923z/micropython-ulab/issues/21","id":570760454,"node_id":"MDEyOklzc3VlQ29tbWVudDU3MDc2MDQ1NA==","user":{"login":"GathererA","id":43546101,"node_id":"MDQ6VXNlcjQzNTQ2MTAx","avatar_url":"https://avatars1.githubusercontent.com/u/43546101?v=4","gravatar_id":"","url":"https://api.github.com/users/GathererA","html_url":"https://github.com/GathererA","followers_url":"https://api.github.com/users/GathererA/followers","following_url":"https://api.github.com/users/GathererA/following{/other_user}","gists_url":"https://api.github.com/users/GathererA/gists{/gist_id}","starred_url":"https://api.github.com/users/GathererA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GathererA/subscriptions","organizations_url":"https://api.github.com/users/GathererA/orgs","repos_url":"https://api.github.com/users/GathererA/repos","events_url":"https://api.github.com/users/GathererA/events{/privacy}","received_events_url":"https://api.github.com/users/GathererA/received_events","type":"User","site_admin":false},"created_at":"2020-01-04T06:12:50Z","updated_at":"2020-01-04T06:12:50Z","author_association":"NONE","body":"Thanks for all the info dhalbert! If it's okay with y'all, I think I'd like to continue to just put everything in shared-bindings until I get a working copy, then port the code over piece by piece to shared-module. Any clue as to where I should start looking into such an obvious pointer error?\r\n\r\n@v923z to answer your question: no, the board breaks whether I use dir(np.array([1]) or just print(np.array([1]))"}}
{"actor":{"display_login":"GathererA"}}