[issue46838] Parameters and arguments parser syntax error improvments

2022-03-22 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 7d810b6a4eab6eba689acc5bb05f85515478d690 by Pablo Galindo Salgado in branch 'main': bpo-46838: Syntax error improvements for function definitions (GH-31590)

[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 error message could be

[issue46838] Parameters and arguments parser syntax error improvments

2022-02-25 Thread Andre Roberge
Change by Andre Roberge : -- nosy: +aroberge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46838] Parameters and arguments parser syntax error improvments

2022-02-25 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +29713 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31590 ___ Python tracker

[issue46838] Parameters and arguments parser syntax error improvments

2022-02-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: With two exceptions, nice suggestions if feasible. >>> def foo(*args=None): pass SyntaxError: * argument cannot have default value >>> def foo(**kwargs=None): pass SyntaxError: ** argument cannot have default value Good. >>> foo(*args=[0]) SyntaxError:

[issue46838] Parameters and arguments parser syntax error improvments

2022-02-23 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Thanks a lot for the suggestions! I will try to give these a go to see if we can get them implemented. Parameter parsing is a bit hairy so not sure how lucky we will be but all of them make sense! -- ___

[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

[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): pass SyntaxError: *