[Python-Dev] codeop: small details (Q); commit priv request

Michael Hudson mwh@python.net
Mon, 12 May 2003 16:22:22 +0100


Samuele Pedroni <pedronis@bluewin.ch> writes:

> 1)
>
> Python 2.3b1 (#40, Apr 25 2003, 19:06:24) [MSC v.1200 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import codeop
>  >>> codeop.compile_command("",symbol="eval")
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "s:\transit\py23\lib\codeop.py", line 129, in compile_command
>      return _maybe_compile(_compile, source, filename, symbol)
>    File "s:\transit\py23\lib\codeop.py", line 106, in _maybe_compile
>      raise SyntaxError, err1
>    File "<input>", line 1
>      pass
>         ^
> SyntaxError: invalid syntax
>
>
> the error is basically an artifact of the logic that enforces:
>
> compile_command("",symbol="single") === compile_command("pass",symbol="single")
>
> (this makes typing enter immediately after the prompt at a simulated
> shell a nop as expected)
>
> I would expect
>
> compile_command("",symbol="eval")
>
> to return None, i.e. to simply signal an incomplete expression (that
> is what would happen if the code for "eval" case would avoid the cited
> logic).

OK, but I think you should preserve the existing behaviour for
symbol="single".

Cheers,
M.

-- 
  I also feel it essential to note, [...], that Description Logics,
  non-Monotonic Logics, Default Logics and Circumscription Logics
  can all collectively go suck a cow. Thank you.
              -- http://advogato.org/person/Johnath/diary.html?start=4