[issue34013] Inconsistent SyntaxError for print

2021-08-10 Thread Terry J. Reedy
Terry J. Reedy added the comment: I think that this was properly closed after the last fix. There are multiple issues at play: 1. These parts of the Zen: "Special cases aren't special enough to break the rules. Although practicality beats purity. ... In the face of ambiguity, refuse the temp

[issue34013] Inconsistent SyntaxError for print

2021-08-10 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: If we change the priority of the error messages, which is unclear if is easily possible, the error will suggest that print hello should be parenthesized as print (hello) Which if corrected will leave the "world" part out as a call followed to a name,

[issue34013] Inconsistent SyntaxError for print

2021-08-10 Thread Andre Roberge
Andre Roberge added the comment: Python 3.10.0rc1 ... >>> print hello world! File "", line 1 print hello world! ^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma? The hint given is not exactly helpful ... (This example was in a discussion on Twitter https:/

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread miss-islington
miss-islington added the comment: New changeset 35035bc35a9cb8617ab9fe9aac38aaf67c926aef by Miss Islington (bot) in branch '3.10': bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521) https://github.com/python/cpython/commit/35035bc35a9cb8617ab9

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread miss-islington
Change by miss-islington : -- pull_requests: +26037 pull_request: https://github.com/python/cpython/pull/27522 ___ Python tracker ___ __

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 208a7e957b812ad3b3733791845447677a704f3e by Pablo Galindo Salgado in branch 'main': bpo-34013: Don't consider a grouped expression when reporting legacy print syntax errors (GH-27521) https://github.com/python/cpython/commit/208a7e957b81

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +26036 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/27521 ___ Python tracker ___

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Is not about the eagerness, the problem is that it matches *first*, the parser never gets to the indentation error in the second phase. For example, with: print(3) $ 34 ❯ ./python bug.py File "/home/pablogsal/github/python/main/bug.py", line 1 p

[issue34013] Inconsistent SyntaxError for print

2021-07-31 Thread Brandt Bucher
Brandt Bucher added the comment: Reopening as a release blocker. It appears that this new rule is far too eager, and matches a much wider range of inputs than intended. Here is a case where it changes an IndentationError into a SyntaxError: $ cat bug.py print() boom On 3.9 (correct):

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread miss-islington
miss-islington added the comment: New changeset 68e3dca0687c4c8e61ed98aed82f81049880c0ce by Miss Islington (bot) in branch '3.10': bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392) https://github.com/python/cpython/commit/68e3dca0687c4c8e61ed98aed82f8

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 15.0 -> 16.0 pull_requests: +25926 pull_request: https://github.com/python/cpython/pull/27393 ___ Python tracker ___

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset ecc3c8e4216958d85385bf2467441c975128f26c by Pablo Galindo Salgado in branch 'main': bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392) https://github.com/python/cpython/commit/ecc3c8e4216958d85385b

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset b977f8510e2ff4f11e3bda920722098a242fc8cc by Pablo Galindo Salgado in branch '3.10': [3.10] bpo-34013: Generalize the invalid legacy statement error message (GH-27389). (GH-27391) https://github.com/python/cpython/commit/b977f8510e2ff4f11

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +25925 pull_request: https://github.com/python/cpython/pull/27392 ___ Python tracker ___ ___

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +25924 pull_request: https://github.com/python/cpython/pull/27391 ___ Python tracker ___ ___

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 6948964ecf94e858448dd28eea634317226d2913 by Pablo Galindo Salgado in branch 'main': bpo-34013: Generalize the invalid legacy statement error message (GH-27389) https://github.com/python/cpython/commit/6948964ecf94e858448dd28eea634317226d2

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Ammar Askar
Change by Ammar Askar : -- pull_requests: +25923 pull_request: https://github.com/python/cpython/pull/27390 ___ Python tracker ___ _

[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +25921 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27389 ___ Python tracker __

[issue34013] Inconsistent SyntaxError for print

2021-07-26 Thread Irit Katriel
Irit Katriel added the comment: This case has changed recently, and not for the better: >>> print f(3) File "", line 1 print f(3) ^^ SyntaxError: invalid syntax. Perhaps you forgot a comma? -- ___ Python tracker

[issue34013] Inconsistent SyntaxError for print

2021-02-20 Thread Lysandros Nikolaou
Change by Lysandros Nikolaou : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue34013] Inconsistent SyntaxError for print

2021-02-19 Thread Andre Roberge
Andre Roberge added the comment: +1 to the idea of adding something to the grammar, and have a simple error message: SyntaxError: Missing parentheses in call to 'print'. in *all* cases, including the first one that prompted this bug report. I write that even though I have created a third-pa

[issue34013] Inconsistent SyntaxError for print

2021-02-19 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Let's step back a bit and focus on the issue at hand. The problem is the following: * We **already** have a warning for the print statement without parens: Python 3.9.1 (default, Dec 14 2020, 11:49:16) [Clang 12.0.0 (clang-1200.0.32.27)] on darwin Typ

[issue34013] Inconsistent SyntaxError for print

2021-02-19 Thread Vedran Čačić
Vedran Čačić added the comment: > "It's still one of the most common beginner mistakes" Do you have any data to back this up? I really think it's overblown. On the other hand, if it really _is_ so, how about changing the language? It wouldn't be the first thing that was changed for Py3, and t

[issue34013] Inconsistent SyntaxError for print

2021-02-19 Thread Irit Katriel
Irit Katriel added the comment: I agree with Terry’s point about printing long expressions in the error msg. Perhaps just the preamble would be useful though: SyntaxError: Missing parentheses in call to 'print'. Instead of just SyntaxError: invalid syntax. -- _

[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: 'Consistency' is in the eye of the beholder in that it is relative to some ideal. 'Inconsistent' has too much baggage as bad'. I would prefer to call the current rule 'restricted' or 'limited' and judge any expansion on its own merits. The arguments to pr

[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Ammar Askar
Ammar Askar added the comment: It's still one of the most common beginner mistakes, personally I think the trade-off in complexity at least for the grammar level fix is worth it here. -- nosy: +ammar2 ___ Python tracker

[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Vedran Čačić
Vedran Čačić added the comment: Aren't we overthinking this? Python 2 is a dead language. It has reached end of life more than a year ago (and was scheduled to do so in 2015). Why are we still trying to accomodate something that stopped being relevant a long time ago? -- nosy: +veky

[issue34013] Inconsistent SyntaxError for print

2021-02-17 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Would it be too much if add a Python 2 rule for print statement in grammar to > produce better error message? Please, go ahead. I think it makes sense and with our latest change in the parser, such new error message will have no impact on performanc

[issue34013] Inconsistent SyntaxError for print

2021-02-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Would it be too much if add a Python 2 rule for print statement in grammar to produce better error message? invalid_print_stmt: | 'print' ( test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ) { RAISE_INVALID_PRINT_STATEMENT(

[issue34013] Inconsistent SyntaxError for print

2021-02-17 Thread Irit Katriel
Irit Katriel added the comment: Still the same in 3.10: Python 3.10.0a5+ (heads/master:bf2e7e55d7, Feb 11 2021, 23:09:25) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print 3 File "", line 1 print 3 ^ SyntaxErr

[issue34013] Inconsistent SyntaxError for print

2018-07-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also #32685. -- nosy: +CuriousLearner, nitishch ___ Python tracker ___ ___ Python-bugs-list

[issue34013] Inconsistent SyntaxError for print

2018-07-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: Eric, Nick, Serhiy: this issue proposes to extend the print message patch of #30597 to cover more cases. On the face of it, this seems sensible, but I have no read the original discussion or the current and proposed patches. -- nosy: +eric.smith, nc

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: @corona10 You might want to discuss this at https://mail.python.org/pipermail/python-ideas/ so that you get some initial feedback on the work and it's acceptance to the core. Thanks -- ___ Python tracke

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na
Dong-hee Na added the comment: And here's my work in progress patch. https://github.com/corona10/cpython/commit/133825346fd60e518e9ab5830a0755250c8c3e79 -- ___ Python tracker ___

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na
Dong-hee Na added the comment: Thanks, my easy patch is worked by pre-checking left paren index. but some edge case which I don't expect should be considered. if (left_paren_index != -1) { -/* Use default error message for any line with an opening paren */ -return 0; +

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na
Dong-hee Na added the comment: >>> class Foo: ... pass ... >>> print Foo().header(a=foo(1)) File "", line 1 print Foo().header(a=foo(1)) ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(Foo().header(a=foo(1)))? -- ___

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I took an initial stab at this and there is a comment where if there is an open paren then to use the normal error message. Additional context on the issue which lists false positive cases where the change was introduced https://bugs.python.org/issu

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Piyush Hajare
Piyush Hajare <4piyushhaj...@gmail.com> added the comment: I'm interested to solve this issue -- nosy: +piyushhajare ___ Python tracker ___

[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na
Dong-hee Na added the comment: @xtreak Thanks, I have interest with this issue :) I will take a look at the implementation Thanks! -- ___ Python tracker ___

[issue34013] Inconsistent SyntaxError for print

2018-06-30 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Related issue that introduced the error message if you would like to take a look at the implementation : https://bugs.python.org/issue30597 Thanks -- nosy: +xtreak ___ Python tracker

[issue34013] Inconsistent SyntaxError for print

2018-06-30 Thread Dong-hee Na
Change by Dong-hee Na : -- components: +Interpreter Core type: -> enhancement ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue34013] Inconsistent SyntaxError for print

2018-06-30 Thread Dong-hee Na
New submission from Dong-hee Na : Python 3.8.0a0 (heads/master-dirty:0cdf5f4289, Jul 1 2018, 02:30:31) [Clang 9.1.0 (clang-902.0.39.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> print "hi" File "", line 1 print "hi" ^ SyntaxError: Mi