Skip to content

Commit eb5f6d6

Browse files
committed
Fix useless ref cycle in lexer
Remove a useless ref cycle in LiteralHandlingIter. This helps the ref count based garbage collection in CPython.
1 parent 2a3a357 commit eb5f6d6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

imapclient/response_lexer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Lexer(object):
5353
"""
5454

5555
def __init__(self, text):
56-
self.sources = (LiteralHandlingIter(self, chunk) for chunk in text)
56+
self.sources = (LiteralHandlingIter(chunk) for chunk in text)
5757
self.current_source = None
5858

5959
def read_until(self, stream_i, end_char, escape=True):
@@ -134,8 +134,7 @@ def __iter__(self):
134134
# literal.
135135
class LiteralHandlingIter:
136136

137-
def __init__(self, lexer, resp_record):
138-
self.lexer = lexer
137+
def __init__(self, resp_record):
139138
if isinstance(resp_record, tuple):
140139
# A 'record' with a string which includes a literal marker, and
141140
# the literal itself.

0 commit comments

Comments
 (0)