[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2022-02-08 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: -> resolved status: open -> closed versions: +Python 3.11 ___ Python tracker ___

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2022-02-08 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: This has been fixed by commit 69e10976b2e7682c6d57f4272932ebc19f8e8859: Python 3.11.0a5+ (heads/main:69e10976b2, Feb 8 2022, 12:30:20) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > "If mode is 'repl', compile returns None to indicate that the code is > incomplete as is but might become valid if more lines (or maybe just more > code) were added" That would be ideal, but my guess is that is not trivial because even if you can

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Add compile(..., mode='repl')? "If mode is 'repl', compile returns None to indicate that the code is incomplete as is but might become valid if more lines (or maybe just more code) were added" Deprecate _maybe_compile (and stop trying to patch it).

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: In any case, the underlying problem here is the fact that codeop is deciding to continue asking for input of not depending on the repr() of the syntax error exception itself, which is the major hack here. Previously, it worked because for unclosed

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Maybe we need to add an API (e.g. a flag to compile()) so that we can ask the > actual parser the question we're interested in, rather than having to use > hacks and heuristics? I was thinking about that, but we need to fix some inconsistencies

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Guido van Rossum
Guido van Rossum added the comment: Maybe we need to add an API (e.g. a flag to compile()) so that we can ask the actual parser the question we're interested in, rather than having to use hacks and heuristics? -- ___ Python tracker

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: This is a change I implemented and is explicitly deactivated in the reprl: https://github.com/python/cpython/blob/master/Parser/pegen.c#L1191 The problem here is that when you call compile() there is no way to know if you are doing it to simulate a

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: #43163 was about the opposite problem of raising SyntaxError too soon, when a valid continuation to imcomplete code is possible. As with that issue, IDLE has the same problem, which is not in code.interact() itself but in codeop._maybe_compile.. Calling

[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

2021-03-02 Thread Andre Roberge
Andre Roberge added the comment: I understand the challenge of reproducing the behaviour of the Python interpreter for this case. If it cannot be reproduced, then the documentation for https://docs.python.org/3/library/code.html#code.InteractiveConsole.interact and others on that page