projects
/
nmigen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
88c00a0
)
sim._pycoro: make src_loc() more robust.
author
whitequark
<whitequark@whitequark.org>
Thu, 27 Aug 2020 07:11:14 +0000
(07:11 +0000)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Fri, 31 Dec 2021 15:11:04 +0000
(15:11 +0000)
* Guard for finished coroutines.
* Guard for coroutines yielding from iterators and not generators.
nmigen/sim/_pycoro.py
patch
|
blob
|
history
diff --git
a/nmigen/sim/_pycoro.py
b/nmigen/sim/_pycoro.py
index 0421d57bce671cafb0a60b546f7bb09cc14b71e0..dbd7601d73d176996276dee8530fce8608d42e04 100644
(file)
--- a/
nmigen/sim/_pycoro.py
+++ b/
nmigen/sim/_pycoro.py
@@
-32,7
+32,9
@@
class PyCoroProcess(Process):
def src_loc(self):
coroutine = self.coroutine
- while coroutine.gi_yieldfrom is not None:
+ if coroutine is None:
+ return None
+ while coroutine.gi_yieldfrom is not None and inspect.isgenerator(coroutine.gi_yieldfrom):
coroutine = coroutine.gi_yieldfrom
if inspect.isgenerator(coroutine):
frame = coroutine.gi_frame