[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-03 Thread Xavier de Gaye
Xavier de Gaye added the comment: > Perhaps we should should test whether the exception happened there and not > drop in the debugger in that case? The same kind of problem occurs for any post-mortem debugging raised by an uncaught exception in the user code: the backtrace displayed by the

[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-02 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- nosy: +BTaskaya ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-02 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Yes, the patch by Terry Reedy fixes this issue while still breaking the loop from `def f: pass`. It will start the debugger once for `def f: pass` which may be weird as in this case no user code has been executed and it will be in bdb which may confuse users:

[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-02 Thread Xavier de Gaye
Xavier de Gaye added the comment: In Kerrick's example ast.literal_eval('') could be ast.literal_eval(some_code) instead where some_code is a string containing dynamically generated Python code. pdb post-mortem debugging must allow finding the syntax error in this code. The patch proposed

[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-01 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: This is related to issue 16180, it may be possible to improve the situation by trying to determine whether the SyntaxError is in the file or came during its execution by looking at the filename but it's probably very brittle: # In most cases

[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-01 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: I've looked into this, in Bdb both the part where the code is compiled and the one where the code is run are in the run() method (https://github.com/python/cpython/blob/master/Lib/bdb.py#L565-L585): def run(self, cmd, globals=None, locals=None):

[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-04-26 Thread Kerrick Staley
New submission from Kerrick Staley : Summary: When you call ast.literal_eval on a string that does not contain valid Python code, it raises a SyntaxError. This causes pdb to exit instead of stopping execution at the point that the SyntaxError was raised. To reproduce: 1. Create a Python file