{"action":"created","issue":{"url":"https://api.github.com/repos/potentialventures/cocotb/issues/637","repository_url":"https://api.github.com/repos/potentialventures/cocotb","labels_url":"https://api.github.com/repos/potentialventures/cocotb/issues/637/labels{/name}","comments_url":"https://api.github.com/repos/potentialventures/cocotb/issues/637/comments","events_url":"https://api.github.com/repos/potentialventures/cocotb/issues/637/events","html_url":"https://github.com/potentialventures/cocotb/issues/637","id":346486231,"node_id":"MDU6SXNzdWUzNDY0ODYyMzE=","number":637,"title":"coroutines that return before their first yield cause the simulator to shutdown","user":{"login":"eric-wieser","id":425260,"node_id":"MDQ6VXNlcjQyNTI2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/425260?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-01T07:48:57Z","updated_at":"2018-10-28T21:43:28Z","closed_at":"2018-10-28T20:25:50Z","author_association":"CONTRIBUTOR","body":"Repro:\r\n```python\r\n@cocotb.test()\r\ndef test_func_empty(dut):\r\n    \"\"\" Test that a function can complete before the first yield \"\"\"\r\n    @cocotb.coroutine\r\n    def func_empty():\r\n        print(\"This line runs\")\r\n        return\r\n        yield  # needed to make this a coroutine\r\n    yield func_empty()\r\n    print(\"This line is never reached\")\r\n```"},"comment":{"url":"https://api.github.com/repos/potentialventures/cocotb/issues/comments/433744242","html_url":"https://github.com/potentialventures/cocotb/issues/637#issuecomment-433744242","issue_url":"https://api.github.com/repos/potentialventures/cocotb/issues/637","id":433744242,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzc0NDI0Mg==","user":{"login":"eric-wieser","id":425260,"node_id":"MDQ6VXNlcjQyNTI2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/425260?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"created_at":"2018-10-28T21:43:28Z","updated_at":"2018-10-28T21:43:28Z","author_association":"CONTRIBUTOR","body":"A less contrived example is:\r\n\r\n```python\r\n@cocotb.test()\r\ndef test_func_empty(dut):\r\n    \"\"\" Test that a function can complete before the first yield \"\"\"\r\n    @cocotb.coroutine\r\n    def wait_if_even(x):\r\n        print(\"This line runs\")\r\n        if x % 2 == 0:\r\n            yield Timer(x)\r\n    yield wait_if_even(2)\r\n    print(\"This line also runs\")\r\n    yield wait_if_even(3)\r\n    print(\"This line is never reached\")\r\n```"}}
{"actor":{"display_login":"eric-wieser"}}