[issue46838] Parameters and arguments parser syntax error improvments

2022-02-25 Thread Andrej Klychin
Andrej Klychin added the comment: @terry.reedy, I based that error message on current >>> foo(**{}, *()) SyntaxError: iterable argument unpacking follows keyword argument unpacking and >>> foo(__debug__=True) SyntaxError: cannot assign to __debug__ but the final e

[issue46838] Parameters and arguments parser syntax error improvments

2022-02-23 Thread Andrej Klychin
Andrej Klychin added the comment: I also sometimes write def foo(pos_only, /*, kwarg): pass. Perhaps this can be special cased with SyntaxError: expected comma between / and * -- ___ Python tracker <https://bugs.python.org/issue46

[issue46838] Parameters and arguments parser syntax error improvments

2022-02-23 Thread Andrej Klychin
New submission from Andrej Klychin : I saw that pablogsal welcomed improvments to the parser's suggestions, so here are the messages for parameters and arguments lists I think should be written instead of the current generic "invalid syntax". >>> def foo(*arg, *arg

[issue41216] eval don't load local variable in dict and list comprehensions.

2020-07-05 Thread Andrej Klychin
New submission from Andrej Klychin : I'm not sure is it a bug or a fecature of comprehensions or eval, but intuitively it seems like it should work. def foo(baz): return eval("[baz for _ in range(10)]") foo(3) Traceback (most recent call last): File "", line 1, i