{"action":"created","issue":{"url":"https://api.github.com/repos/numba/numba/issues/2771","repository_url":"https://api.github.com/repos/numba/numba","labels_url":"https://api.github.com/repos/numba/numba/issues/2771/labels{/name}","comments_url":"https://api.github.com/repos/numba/numba/issues/2771/comments","events_url":"https://api.github.com/repos/numba/numba/issues/2771/events","html_url":"https://github.com/numba/numba/issues/2771","id":299980177,"node_id":"MDU6SXNzdWUyOTk5ODAxNzc=","number":2771,"title":"The tuple built-in is not supported in nopython mode","user":{"login":"krrk","id":4636304,"node_id":"MDQ6VXNlcjQ2MzYzMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4636304?v=4","gravatar_id":"","url":"https://api.github.com/users/krrk","html_url":"https://github.com/krrk","followers_url":"https://api.github.com/users/krrk/followers","following_url":"https://api.github.com/users/krrk/following{/other_user}","gists_url":"https://api.github.com/users/krrk/gists{/gist_id}","starred_url":"https://api.github.com/users/krrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krrk/subscriptions","organizations_url":"https://api.github.com/users/krrk/orgs","repos_url":"https://api.github.com/users/krrk/repos","events_url":"https://api.github.com/users/krrk/events{/privacy}","received_events_url":"https://api.github.com/users/krrk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2018-02-24T22:58:52Z","updated_at":"2018-12-29T02:12:04Z","closed_at":null,"author_association":"NONE","body":"The `tuple([iterable])` python built-in function doesn't work in nopython mode. Is there any plan to support this in nopython mode?\r\n\r\nThis would be very helpful for some functions like `numpy.ndindex(*shape)` which in numba must be called with a tuple. In addition in nopython mode generating a tuple by tuple addition (concatenation) in a for loop does not work.\r\n\r\nMinimal function for use of tuple:\r\n```python\r\n@jit(nopython=True)\r\ndef g():\r\n    tuple()\r\n```\r\nResulting error:\r\n```python\r\nUntyped global name 'tuple': cannot determine Numba type of <class 'type'>\r\n```\r\nTrying to generate a tuple using a for loop:\r\n```python\r\n@jit(nopython=True)\r\ndef foo():\r\n    t = ()\r\n    for i in range(-10, 11):\r\n        t += (i,)\r\n    return t\r\n```\r\nResulting error:\r\n```python\r\ncannot unify () and (int64 x 1) for 't'\r\n```\r\n\r\nAlso after reading through the documentation (section 2.6) I had expected that this would work. Here are the relevant parts of that documentation:\r\n\r\n> 2.6. Supported Python features¶\r\n> \r\n> Apart from the Language part below, which applies to both object mode and nopython mode, this page only lists the features supported in nopython mode.\r\n\r\n> 2.6.2.3. tuple\r\n> \r\n> The following operations are supported:\r\n> \r\n>     tuple construction\r\n>     tuple unpacking\r\n>     comparison between tuples\r\n>     iteration and indexing over homogenous tuples\r\n>     addition (concatenation) between tuples\r\n>     slicing tuples with a constant slice\r\n> \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/numba/numba/issues/comments/450455926","html_url":"https://github.com/numba/numba/issues/2771#issuecomment-450455926","issue_url":"https://api.github.com/repos/numba/numba/issues/2771","id":450455926,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDQ1NTkyNg==","user":{"login":"Julia1211","id":42441001,"node_id":"MDQ6VXNlcjQyNDQxMDAx","avatar_url":"https://avatars2.githubusercontent.com/u/42441001?v=4","gravatar_id":"","url":"https://api.github.com/users/Julia1211","html_url":"https://github.com/Julia1211","followers_url":"https://api.github.com/users/Julia1211/followers","following_url":"https://api.github.com/users/Julia1211/following{/other_user}","gists_url":"https://api.github.com/users/Julia1211/gists{/gist_id}","starred_url":"https://api.github.com/users/Julia1211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Julia1211/subscriptions","organizations_url":"https://api.github.com/users/Julia1211/orgs","repos_url":"https://api.github.com/users/Julia1211/repos","events_url":"https://api.github.com/users/Julia1211/events{/privacy}","received_events_url":"https://api.github.com/users/Julia1211/received_events","type":"User","site_admin":false},"created_at":"2018-12-29T02:12:04Z","updated_at":"2018-12-29T02:12:04Z","author_association":"NONE","body":"@krrk \r\nThanks for your reply.And I have one other question that is there is a function A,and A will call an other function B during running program. np.ones([w,h]) is used in function B,so it has an error like that :\r\n\r\nnumba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)\r\nFailed in nopython mode pipeline (step: nopython frontend)\r\nUntyped global name 'B': cannot determine Numba type of <class 'function'>\r\n\r\nB is so long that can't be merged into function A,so how can I change the code in this question?\r\n   \r\n"}}
{"actor":{"display_login":"Julia1211"}}