coroutines that return before their first yield cause the simulator to shutdown
See original GitHub issueRepro:
@cocotb.test()
def test_func_empty(dut):
""" Test that a function can complete before the first yield """
@cocotb.coroutine
def func_empty():
print("This line runs")
return
yield # needed to make this a coroutine
yield func_empty()
print("This line is never reached")
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Coroutines — cocotb 1.1 documentation
Typically coroutines yield a Trigger object which indicates to the simulator some event which will cause the coroutine to be woken when it...
Read more >Classic Coroutines | Fluent Python, the lizard book
How coroutines can return values upon termination. Usage and semantics of the new yield from syntax. A use case: coroutines for managing concurrent...
Read more >Scripting: What resumes when I yield(0) from a coroutine ...
The statement "coroutine.yield(0)" should cause control flow to return to a statement like "return_value = coroutine.resume(coroutine_name)" ...
Read more >Making sense of generators, coroutines, and "yield from" in ...
That's because Python reaches that first “return” statement and returns 1. ... Because generators (i.e., the objects returned by generator ...
Read more >Scripting API: MonoBehaviour.StartCoroutine - Unity - Manual
The StartCoroutine method returns upon the first yield return, however you can yield the result, which waits until the coroutine has finished execution....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If I remove all of the
clk_gen = cocotb.fork(Clock(dut.clk, 100).start())
lines and run thetest_external
module on #1705, everything passes.It looks to me like
test_ext_exit_error
is just nonsense - I’d remove it as part of the cleanup.