Show More
@@ -153,13 +153,13 b' def _should_be_async(cell: str) -> bool:' | |||
|
153 | 153 | try: |
|
154 | 154 | code = compile(cell, "<>", "exec", flags=getattr(ast,'PyCF_ALLOW_TOP_LEVEL_AWAIT', 0x0)) |
|
155 | 155 | return inspect.CO_COROUTINE & code.co_flags == inspect.CO_COROUTINE |
|
156 | except SyntaxError: | |
|
156 | except (SyntaxError, MemoryError): | |
|
157 | 157 | return False |
|
158 | 158 | try: |
|
159 | 159 | # we can't limit ourself to ast.parse, as it __accepts__ to parse on |
|
160 | 160 | # 3.7+, but just does not _compile_ |
|
161 | 161 | code = compile(cell, "<>", "exec") |
|
162 | except SyntaxError: | |
|
162 | except (SyntaxError, MemoryError): | |
|
163 | 163 | try: |
|
164 | 164 | parse_tree = _async_parse_cell(cell) |
|
165 | 165 | |
@@ -167,7 +167,7 b' def _should_be_async(cell: str) -> bool:' | |||
|
167 | 167 | v = _AsyncSyntaxErrorVisitor() |
|
168 | 168 | v.visit(parse_tree) |
|
169 | 169 | |
|
170 | except SyntaxError: | |
|
170 | except (SyntaxError, MemoryError): | |
|
171 | 171 | return False |
|
172 | 172 | return True |
|
173 | 173 | return False |
General Comments 0
You need to be logged in to leave comments.
Login now