Commit 7ce010cb authored by Guido van Rossum's avatar Guido van Rossum

asyncio: Be careful accessing instance variables in __del__ (closes #21340).

parent 7bf75c9f
......@@ -76,7 +76,9 @@ class CoroWrapper:
return self.gen.gi_code
def __del__(self):
frame = self.gen.gi_frame
# Be careful accessing self.gen.frame -- self.gen might not exist.
gen = getattr(self, 'gen', None)
frame = getattr(gen, 'gi_frame', None)
if frame is not None and frame.f_lasti == -1:
func = self.func
code = func.__code__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment