Issue2816
Created on 2008-05-11 07:26 by chester, last changed 2008-05-11 16:44 by chester.
| msg66607 (view) |
Author: Chester (chester) |
Date: 2008-05-11 07:26 |
|
Let's make an intentional syntax error...
>>> print "Testing\"
SyntaxError: EOL while scanning single-quoted string
Please focus on the part of the error message that states "while
scanning single-quoted string". How can Python claim it scanned a
single-quoted string when I fed it with a double-quoted string? That is
a quote type recognition bug in Python which should be fixed.
The error message in this case should, however, be:
SyntaxError: EOL while scanning double-quoted string
|
| msg66608 (view) |
Author: Robert Lehmann (lehmannro) |
Date: 2008-05-11 07:32 |
|
It seems "single-quoted" doesn't mean the actual quotation sign used but
rather how many you used. Compare the multiline triple quote syntax:
$ cat foo.py
"""bar
$ python foo.py
File "foo.py", line 3
^
SyntaxError: EOF while scanning triple-quoted string
This shouldn't read sextuple-quoted string, should it?
|
| msg66609 (view) |
Author: Chester (chester) |
Date: 2008-05-11 07:42 |
|
I have e-mailed Guido van Rossum about this. He replied: "Good find.
Please file a bug on bugs.python.org." If that wasn't a bug, he wouldn't
have said that, would he?
|
| msg66612 (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2008-05-11 08:53 |
|
This is not a bug in my opinion -- Robert has stated why.
However, since you contacted Guido, let him decide. :)
|
| msg66636 (view) |
Author: Guido van Rossum (gvanrossum) |
Date: 2008-05-11 15:03 |
|
As the term "single-quoted string" is clearly ambiguous, I propose to
change the error message to just "string" (or perhaps "string literal",
but then you'd have to change the triple-quoted message to
"triple-quoted string literal" too for consistency).
|
| msg66637 (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2008-05-11 15:07 |
|
OK, done so in r63068.
|
| msg66642 (view) |
Author: Chester (chester) |
Date: 2008-05-11 16:44 |
|
It would be better to say
"End of line while scanning string (<string>, line 1)"
and
"End of f... while scanning multi-line string (<string>, line 1)"
These messages really need to be clear, so putting EOF for example
(which I really don't know what it stands for) is really mind-bending.
|
|
| Date |
User |
Action |
Args |
| 2008-05-11 16:44:37 | chester | set | messages:
+ msg66642 |
| 2008-05-11 15:07:54 | georg.brandl | set | status: open -> closed resolution: fixed messages:
+ msg66637 |
| 2008-05-11 15:03:36 | gvanrossum | set | messages:
+ msg66636 |
| 2008-05-11 08:53:13 | georg.brandl | set | assignee: gvanrossum messages:
+ msg66612 nosy:
+ gvanrossum, georg.brandl |
| 2008-05-11 07:53:56 | chester | set | versions:
+ 3rd party |
| 2008-05-11 07:51:47 | chester | set | versions:
+ Python 2.6, Python 2.5, Python 2.4, Python 2.3, Python 2.2.3, Python 2.2.2, Python 2.2.1, Python 2.2, Python 2.1.2, Python 2.1.1 |
| 2008-05-11 07:50:15 | chester | set | versions:
+ Python 3.0, - Python 2.5 |
| 2008-05-11 07:42:19 | chester | set | messages:
+ msg66609 |
| 2008-05-11 07:32:42 | lehmannro | set | nosy:
+ lehmannro messages:
+ msg66608 |
| 2008-05-11 07:26:21 | chester | create | |
|