diff options
author | Guido van Rossum <guido@python.org> | 2014-04-27 17:33:58 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2014-04-27 17:33:58 (GMT) |
commit | 83c1ddda469e7a99f11afc7d6758b3d80ad9aa3b (patch) | |
tree | 2c5fe94963ea9379b0102d7ca5e12846dbaa4525 /Lib/asyncio/tasks.py | |
parent | ae25f46706659575c91d579ebcae02584e624ad9 (diff) | |
download | cpython-83c1ddda469e7a99f11afc7d6758b3d80ad9aa3b.zip cpython-83c1ddda469e7a99f11afc7d6758b3d80ad9aa3b.tar.gz cpython-83c1ddda469e7a99f11afc7d6758b3d80ad9aa3b.tar.bz2 |
asyncio: Be careful accessing instance variables in __del__ (closes #21340).
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r-- | Lib/asyncio/tasks.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index c6c22dd..e8ee947 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -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__ |