4747PyCF_ONLY_AST = 0x400
4848PyCF_ALLOW_INCOMPLETE_INPUT = 0x4000
4949
50- def _maybe_compile (compiler , source , filename , symbol , flags ):
50+ def _maybe_compile (compiler , source , filename , symbol ):
5151 # Check for source consisting of only blank lines and comments.
5252 for line in source .split ("\n " ):
5353 line = line .strip ()
@@ -61,21 +61,22 @@ def _maybe_compile(compiler, source, filename, symbol, flags):
6161 with warnings .catch_warnings ():
6262 warnings .simplefilter ("ignore" , (SyntaxWarning , DeprecationWarning ))
6363 try :
64- compiler (source , filename , symbol , flags = flags )
64+ compiler (source , filename , symbol )
6565 except _IncompleteInputError :
6666 return None
6767 except SyntaxError : # Let other compile() errors propagate.
6868 pass
6969
7070 return compiler (source , filename , symbol , incomplete_input = False )
7171
72- def _compile (source , filename , symbol , incomplete_input = True , * , flags = 0 ):
72+ def _compile (source , filename , symbol , incomplete_input = True ):
73+ flags = 0
7374 if incomplete_input :
7475 flags |= PyCF_ALLOW_INCOMPLETE_INPUT
7576 flags |= PyCF_DONT_IMPLY_DEDENT
7677 return compile (source , filename , symbol , flags )
7778
78- def compile_command (source , filename = "<input>" , symbol = "single" , flags = 0 ):
79+ def compile_command (source , filename = "<input>" , symbol = "single" ):
7980 r"""Compile a command and determine whether it is incomplete.
8081
8182 Arguments:
@@ -94,7 +95,7 @@ def compile_command(source, filename="<input>", symbol="single", flags=0):
9495 syntax error (OverflowError and ValueError can be produced by
9596 malformed literals).
9697 """
97- return _maybe_compile (_compile , source , filename , symbol , flags )
98+ return _maybe_compile (_compile , source , filename , symbol )
9899
99100class Compile :
100101 """Instances of this class behave much like the built-in compile
@@ -146,4 +147,4 @@ def __call__(self, source, filename="<input>", symbol="single"):
146147 syntax error (OverflowError and ValueError can be produced by
147148 malformed literals).
148149 """
149- return _maybe_compile (self .compiler , source , filename , symbol , flags = self . compiler . flags )
150+ return _maybe_compile (self .compiler , source , filename , symbol )
0 commit comments