[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread miss-islington


miss-islington  added the comment:


New changeset b1bd16c2528295b8b28395827f6b589dccea0624 by Pablo Galindo Salgado 
in branch '3.10':
[3.10] bpo-44838: Refine the custom syntax errors for invalid 'if' expressions 
(GH-27615). (GH-27616)
https://github.com/python/cpython/commit/b1bd16c2528295b8b28395827f6b589dccea0624


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +26110
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27616

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f5cbea6b1b5fc39cca377c6cc93f222916015fc4 by Pablo Galindo Salgado 
in branch 'main':
bpo-44838: Refine the custom syntax errors for invalid 'if' expressions 
(GH-27615)
https://github.com/python/cpython/commit/f5cbea6b1b5fc39cca377c6cc93f222916015fc4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Opened https://github.com/python/cpython/pull/27615

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> but when you do the test to identify if an 'else' is missing, could the fact 
> that there is a colon instead of the expected 'else' be used to avoid 
> misidentifying this case?

Yeah! That is what I was thinking. The key here is that the ':' is the only 
token that is valid after the construct, so anything else is a wrong 'if' 
expression, no matter what it is.

--
stage: patch review -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +26109
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27615

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Technically this example si more or less equivalent to:

[ something, blech

if 42:
   True

[Bluch]]

I wonder if the better fix here is just not to raise the rule if we find a ':', 
which is the only token that actually makes sense after 

'if' expression

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Andre Roberge


Andre Roberge  added the comment:

I have no idea how the parser works ... but when you do the test to identify if 
an 'else' is missing, could the fact that there is a colon instead of the 
expected 'else' be used to avoid misidentifying this case?

Note: I am keenly aware of the difficulties in identifying possible cause of 
syntax errors and do appreciate the many improvements that have been done.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is a tricky one because the tokenizer doesn't see the enclosed parentheses 
because is actually closed (the second print has two 
')' parentheses).

This is tricky indeed because the parser is parsing the ( after the print as a 
group, not as a call, and indentation doesn't matter in the group.

We can indeed revert the PR but I'm afraid that you can use this pattern to 
actually trigger a bunch of other custom error messages where they should not.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

Oh, this is a difficult one.

It's caused by GH-27506 that was recently added to produce better errors for 
things like `print('hello' if something)`, where the correct syntax is 
`print('hello' if something else 'hi').

This is going to have a lot of false positives though, especially in cases like 
this, where an if statement immediately follows a line with unclosed 
parentheses.

What do you think, Pablo? Should we maybe revert this?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

2021-08-05 Thread Andre Roberge


New submission from Andre Roberge :

Given the following code containing no if expression (only if statements):

if True:
print('hello'

if 2:
print(123))

The following traceback is generated in Python 3.10.0RC1

  File "...\example.py", line 2
print('hello'
  ^^^
SyntaxError: expected 'else' after 'if' expression

--
components: Parser
messages: 398989
nosy: aroberge, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: SyntaxError: New message "expected 'else' after 'if' expression" wrongly 
shown
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue44838>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26879] new message

2016-04-28 Thread Ethan Furman

Changes by Ethan Furman :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26879] new message

2016-04-28 Thread Rogi

New submission from Rogi:

Hello!

You have a new message, please read <http://www.gazzaz.com.sa/territory.php?v>

r...@linuxmail.org

--
messages: 264455
nosy: Rogi
priority: normal
severity: normal
status: open
title: new message

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26879>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



New message

2009-08-19 Thread La Vie Spirituelle
Test
-- 
http://mail.python.org/mailman/listinfo/python-list