[Python-Dev] codeop: small details (Q); commit priv request (original) (raw)
Samuele Pedroni pedronis@bluewin.ch
Mon, 12 May 2003 16:48:01 +0200
- Previous message: [Python-Dev] Random SF tracker ettiquete questions
- Next message: [Python-Dev] codeop: small details (Q); commit priv request
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 "", 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 "", 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).
- symbol = "exec" is silently accepted but the documentation intentionally only refers to "exec" and "single" as valid values for symbol. Maybe a ValueError should be raised.
Context: I was working on improving Jython codeop compatibility with CPython codeop.
Btw, as considered here by Guido http://sourceforge.net/tracker/index.php?func=detail&aid=645404&group_id=5470&atid=305470 I would ask to have commit privileges for CPython
regards
- Previous message: [Python-Dev] Random SF tracker ettiquete questions
- Next message: [Python-Dev] codeop: small details (Q); commit priv request
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]