Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote-type recognition bug #47065

Closed
chester mannequin opened this issue May 11, 2008 · 7 comments
Closed

Quote-type recognition bug #47065

chester mannequin opened this issue May 11, 2008 · 7 comments
Assignees

Comments

@chester
Copy link
Mannequin

chester mannequin commented May 11, 2008

BPO 2816
Nosy @gvanrossum, @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/gvanrossum'
closed_at = <Date 2008-05-11.15:07:54.032>
created_at = <Date 2008-05-11.07:26:21.312>
labels = []
title = 'Quote-type recognition bug'
updated_at = <Date 2008-05-11.16:44:37.405>
user = 'https://bugs.python.org/chester'

bugs.python.org fields:

activity = <Date 2008-05-11.16:44:37.405>
actor = 'chester'
assignee = 'gvanrossum'
closed = True
closed_date = <Date 2008-05-11.15:07:54.032>
closer = 'georg.brandl'
components = []
creation = <Date 2008-05-11.07:26:21.312>
creator = 'chester'
dependencies = []
files = []
hgrepos = []
issue_num = 2816
keywords = []
message_count = 7.0
messages = ['66607', '66608', '66609', '66612', '66636', '66637', '66642']
nosy_count = 4.0
nosy_names = ['gvanrossum', 'georg.brandl', 'lehmannro', 'chester']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue2816'
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', '3rd party', 'Python 3.0']

@chester
Copy link
Mannequin Author

chester mannequin commented May 11, 2008

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

@lehmannro
Copy link
Mannequin

lehmannro mannequin commented May 11, 2008

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?

@chester
Copy link
Mannequin Author

chester mannequin commented May 11, 2008

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?

@birkenfeld
Copy link
Member

This is not a bug in my opinion -- Robert has stated why.

However, since you contacted Guido, let him decide. :)

@gvanrossum
Copy link
Member

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).

@birkenfeld
Copy link
Member

OK, done so in r63068.

@chester
Copy link
Mannequin Author

chester mannequin commented May 11, 2008

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants