{"action":"created","issue":{"url":"https://api.github.com/repos/angr/claripy/issues/28","repository_url":"https://api.github.com/repos/angr/claripy","labels_url":"https://api.github.com/repos/angr/claripy/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/angr/claripy/issues/28/comments","events_url":"https://api.github.com/repos/angr/claripy/issues/28/events","html_url":"https://github.com/angr/claripy/issues/28","id":190040515,"number":28,"title":"How to use extra_constraints","user":{"login":"frapik99","id":22319973,"avatar_url":"https://avatars.githubusercontent.com/u/22319973?v=3","gravatar_id":"","url":"https://api.github.com/users/frapik99","html_url":"https://github.com/frapik99","followers_url":"https://api.github.com/users/frapik99/followers","following_url":"https://api.github.com/users/frapik99/following{/other_user}","gists_url":"https://api.github.com/users/frapik99/gists{/gist_id}","starred_url":"https://api.github.com/users/frapik99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frapik99/subscriptions","organizations_url":"https://api.github.com/users/frapik99/orgs","repos_url":"https://api.github.com/users/frapik99/repos","events_url":"https://api.github.com/users/frapik99/events{/privacy}","received_events_url":"https://api.github.com/users/frapik99/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-17T12:59:39Z","updated_at":"2016-11-17T17:00:21Z","closed_at":"2016-11-17T17:00:21Z","body":"Hi,\r\nthanks in advance for your help:\r\n\r\nmy code is the following:\r\n```\r\nimport claripy\r\ns = claripy.Solver()\r\nx = claripy.BVS(\"x\",64)\r\nten = claripy.BVV(10,64)\r\ns.add(x==ten)\r\nprint s.satisfiable()\r\nprint s.satisfiable(extra_constraints=(x == 2))\r\n```\r\n\r\nThe first satisfiable returns True as expected but for the second I have the following error:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"a.py\", line 12, in <module>\r\n    print s.satisfiable(extra_constraints=(x == 2))\r\n  File \"/usr/local/lib/python2.7/dist-packages/claripy/frontend_mixins/constraint_filter_mixin.py\", line 30, in satisfiable\r\n    ec = self._constraint_filter(extra_constraints)\r\n  File \"/usr/local/lib/python2.7/dist-packages/claripy/frontend_mixins/constraint_filter_mixin.py\", line 3, in _constraint_filter\r\n    if len(constraints) == 0:\r\nTypeError: object of type 'Bool' has no len()\r\n```\r\n\r\nCould you tell me how to add properly that kind of extra constraint?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/angr/claripy/issues/comments/261304166","html_url":"https://github.com/angr/claripy/issues/28#issuecomment-261304166","issue_url":"https://api.github.com/repos/angr/claripy/issues/28","id":261304166,"user":{"login":"zardus","id":3453847,"avatar_url":"https://avatars.githubusercontent.com/u/3453847?v=3","gravatar_id":"","url":"https://api.github.com/users/zardus","html_url":"https://github.com/zardus","followers_url":"https://api.github.com/users/zardus/followers","following_url":"https://api.github.com/users/zardus/following{/other_user}","gists_url":"https://api.github.com/users/zardus/gists{/gist_id}","starred_url":"https://api.github.com/users/zardus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zardus/subscriptions","organizations_url":"https://api.github.com/users/zardus/orgs","repos_url":"https://api.github.com/users/zardus/repos","events_url":"https://api.github.com/users/zardus/events{/privacy}","received_events_url":"https://api.github.com/users/zardus/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T17:00:21Z","updated_at":"2016-11-17T17:00:21Z","body":"You're passing a scalar value to `extra_constraints`, but it should be an iterable. Try this:\r\n\r\n```print s.satisfiable(extra_constraints=(x == 2,))```"}}
{"actor":{"display_login":"zardus"}}