##// END OF EJS Templates
some more fixes for 3.8
Matthias Bussonnier -
Show More
@@ -150,9 +150,11 b' def _should_be_async(cell: str) -> bool:'
150 level, it will be seen as async. This is a know limitation.
150 level, it will be seen as async. This is a know limitation.
151 """
151 """
152 if sys.version_info > (3, 8):
152 if sys.version_info > (3, 8):
153 code = compile(cell, "<>", "exec", flags=getattr(ast,'PyCF_ALLOW_TOP_LEVEL_AWAIT', 0x0))
153 try:
154 return inspect.CO_COROUTINE & code.co_flags == inspect.CO_COROUTINE
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:
157 return False
156 try:
158 try:
157 # we can't limit ourself to ast.parse, as it __accepts__ to parse on
159 # we can't limit ourself to ast.parse, as it __accepts__ to parse on
158 # 3.7+, but just does not _compile_
160 # 3.7+, but just does not _compile_
@@ -137,12 +137,17 b' class CachingCompiler(codeop.Compile):'
137
137
138 @contextmanager
138 @contextmanager
139 def extra_flags(self, flags):
139 def extra_flags(self, flags):
140 old_flags = self.flags
140 ## bits that we'll set to 1
141 turn_on_bits = ~self.flags & flags
142
143
141 self.flags = self.flags | flags
144 self.flags = self.flags | flags
142 try:
145 try:
143 yield
146 yield
144 finally:
147 finally:
145 self.flags = old_flags
148 # turn off only the bits we turned on so that something like
149 # __future__ that set flags stays.
150 self.flags &= ~turn_on_bits
146
151
147
152
148 def check_linecache_ipython(*args):
153 def check_linecache_ipython(*args):
General Comments 0
You need to be logged in to leave comments. Login now