diff options
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r-- | Lib/contextlib.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py index ef8f8c9..1ff8cdf 100644 --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -105,6 +105,9 @@ class _GeneratorContextManager(_GeneratorContextManagerBase, return self.__class__(self.func, self.args, self.kwds) def __enter__(self): + # do not keep args and kwds alive unnecessarily + # they are only needed for recreation, which is not possible anymore + del self.args, self.kwds, self.func try: return next(self.gen) except StopIteration: |