New submission from Pablo Galindo Salgado <pablog...@gmail.com>:

Let's asume this string:
"
x = "Cannot recover from "MemoryErrors" while something happnes while "

The line is incorrect because the quotes arround MemoryErrors are the same as 
the string is used, resulting in STRING + expression + STRING.

Currenly we say:

>>> 'Cannot recover from 'MemoryErrors' while '
  File "<stdin>", line 1
    'Cannot recover from 'MemoryErrors' while '
                          ^
SyntaxError: invalid syntax

but I think it will be a great improvement if we say:

>>> 'Cannot recover from 'MemoryErrors' while '
  File "<stdin>", line 1
    'Cannot recover from 'MemoryErrors' while '
                          ^^^^^^^^^^^^
SyntaxError: invalid syntax. Did you use the same quotes here as the string?

Probably the message should be better, but I think this is a good improvement.

----------
components: Parser
messages: 395476
nosy: lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Improve syntax error for wrongly closed strings
versions: Python 3.10, Python 3.11

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

Reply via email to