{"action":"opened","issue":{"url":"https://api.github.com/repos/numba/numba/issues/1243","labels_url":"https://api.github.com/repos/numba/numba/issues/1243/labels{/name}","comments_url":"https://api.github.com/repos/numba/numba/issues/1243/comments","events_url":"https://api.github.com/repos/numba/numba/issues/1243/events","html_url":"https://github.com/numba/numba/issues/1243","id":89591119,"number":1243,"title":"Allow nopython code to raise warnings","user":{"login":"sklam","id":1929845,"avatar_url":"https://avatars.githubusercontent.com/u/1929845?v=3","gravatar_id":"","url":"https://api.github.com/users/sklam","html_url":"https://github.com/sklam","followers_url":"https://api.github.com/users/sklam/followers","following_url":"https://api.github.com/users/sklam/following{/other_user}","gists_url":"https://api.github.com/users/sklam/gists{/gist_id}","starred_url":"https://api.github.com/users/sklam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sklam/subscriptions","organizations_url":"https://api.github.com/users/sklam/orgs","repos_url":"https://api.github.com/users/sklam/repos","events_url":"https://api.github.com/users/sklam/events{/privacy}","received_events_url":"https://api.github.com/users/sklam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-19T15:23:38Z","updated_at":"2015-06-19T15:23:38Z","closed_at":null,"body":"NumPy uses warnings to communicate errors in computation (e.g. divide-by-zero).\r\nNumba needs to do the same when executing jitted numpy ufuncs.\r\n\r\nExample:\r\n\r\n```python\r\n>>> def foo(a, b):\r\n...     return np.floor_divide(a, b)\r\n... \r\n>>> numba.jit(foo)(0, 0)\r\n0\r\n```\r\n\r\nSince numba did not raise a warning, we appear to be doing something stupid even though we are just matching the result of numpy.\r\n\r\n**Suggestions**\r\n\r\nOption 1: Use a new return status code to indicate a warning has occurred.  This may allow us to have just one warning\r\n\r\nOption 2: Let each target decide how warnings are reported by invoking an external function that is resolved by the target at load time.  1) When used in python, just delegate to libpython API. 2) When used in pycc, NRT may provide an implementation (e.g. print to stderr).  3) In CUDA-Python, just print?\r\n"}}