{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/9097","labels_url":"https://api.github.com/repos/sympy/sympy/issues/9097/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/9097/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/9097/events","html_url":"https://github.com/sympy/sympy/pull/9097","id":59936228,"number":9097,"title":"Prime numbers are only Integers.","user":{"login":"amarveer","id":11295666,"avatar_url":"https://avatars.githubusercontent.com/u/11295666?v=3","gravatar_id":"","url":"https://api.github.com/users/amarveer","html_url":"https://github.com/amarveer","followers_url":"https://api.github.com/users/amarveer/followers","following_url":"https://api.github.com/users/amarveer/following{/other_user}","gists_url":"https://api.github.com/users/amarveer/gists{/gist_id}","starred_url":"https://api.github.com/users/amarveer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amarveer/subscriptions","organizations_url":"https://api.github.com/users/amarveer/orgs","repos_url":"https://api.github.com/users/amarveer/repos","events_url":"https://api.github.com/users/amarveer/events{/privacy}","received_events_url":"https://api.github.com/users/amarveer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sympy/sympy/labels/NumberTheory","name":"NumberTheory","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-05T11:00:27Z","updated_at":"2015-03-14T10:06:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/9097","html_url":"https://github.com/sympy/sympy/pull/9097","diff_url":"https://github.com/sympy/sympy/pull/9097.diff","patch_url":"https://github.com/sympy/sympy/pull/9097.patch"},"body":"Before:\r\n```\r\n>>> isprime(3.2)\r\nTrue\r\n```\r\n\r\nAfter:\r\n```\r\n>>> isprime(3.2)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"sympy/ntheory/primetest.py\", line 207, in isprime\r\n    n = as_int(n)\r\n  File \"sympy/core/compatibility.py\", line 388, in as_int\r\n    raise ValueError('%s is not an integer' % n)\r\nValueError: 3.2 is not an integer\r\n```"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/80256981","html_url":"https://github.com/sympy/sympy/pull/9097#issuecomment-80256981","issue_url":"https://api.github.com/repos/sympy/sympy/issues/9097","id":80256981,"user":{"login":"smichr","id":90703,"avatar_url":"https://avatars.githubusercontent.com/u/90703?v=3","gravatar_id":"","url":"https://api.github.com/users/smichr","html_url":"https://github.com/smichr","followers_url":"https://api.github.com/users/smichr/followers","following_url":"https://api.github.com/users/smichr/following{/other_user}","gists_url":"https://api.github.com/users/smichr/gists{/gist_id}","starred_url":"https://api.github.com/users/smichr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smichr/subscriptions","organizations_url":"https://api.github.com/users/smichr/orgs","repos_url":"https://api.github.com/users/smichr/repos","events_url":"https://api.github.com/users/smichr/events{/privacy}","received_events_url":"https://api.github.com/users/smichr/received_events","type":"User","site_admin":false},"created_at":"2015-03-14T10:06:27Z","updated_at":"2015-03-14T10:06:27Z","body":"My suggestion would be to return False for non-Integer input as the assumption system does:\r\n\r\n```\r\n>>> S(3.0).is_prime\r\nFalse\r\n```\r\n\r\nA float is not an exact entity so one can't know if it has a nonzero digit past the known precision. Silently assuming that the input is an exact integer is probably a bad idea. So rather than use `as_int` I would suggest testing that `if not isinstance(n, (Integer, long, int)): raise ValueError`."}}