sim._pycoro: make src_loc() more robust.
* Guard for finished coroutines. * Guard for coroutines yielding from iterators and not generators.
This commit is contained in:
parent
141eaf0e40
commit
c00219d9f3
|
@ -32,7 +32,9 @@ class PyCoroProcess(Process):
|
||||||
|
|
||||||
def src_loc(self):
|
def src_loc(self):
|
||||||
coroutine = self.coroutine
|
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
|
coroutine = coroutine.gi_yieldfrom
|
||||||
if inspect.isgenerator(coroutine):
|
if inspect.isgenerator(coroutine):
|
||||||
frame = coroutine.gi_frame
|
frame = coroutine.gi_frame
|
||||||
|
|
Loading…
Reference in a new issue