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

String double quoted fatal problem #48414

Closed
cliffdover88 mannequin opened this issue Oct 21, 2008 · 2 comments
Closed

String double quoted fatal problem #48414

cliffdover88 mannequin opened this issue Oct 21, 2008 · 2 comments
Labels
build The build process and cross-build stdlib Python modules in the Lib dir

Comments

@cliffdover88
Copy link
Mannequin

cliffdover88 mannequin commented Oct 21, 2008

BPO 4164
Nosy @amauryfa

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 = None
closed_at = <Date 2008-10-21.21:05:19.495>
created_at = <Date 2008-10-21.20:10:24.689>
labels = ['invalid', 'build', 'library']
title = 'String double quoted fatal problem'
updated_at = <Date 2008-10-21.21:05:19.440>
user = 'https://bugs.python.org/cliffdover88'

bugs.python.org fields:

activity = <Date 2008-10-21.21:05:19.440>
actor = 'amaury.forgeotdarc'
assignee = 'none'
closed = True
closed_date = <Date 2008-10-21.21:05:19.495>
closer = 'amaury.forgeotdarc'
components = ['Library (Lib)']
creation = <Date 2008-10-21.20:10:24.689>
creator = 'cliffdover88'
dependencies = []
files = []
hgrepos = []
issue_num = 4164
keywords = []
message_count = 2.0
messages = ['75038', '75047']
nosy_count = 2.0
nosy_names = ['amaury.forgeotdarc', 'cliffdover88']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue4164'
versions = ['Python 2.6']

@cliffdover88
Copy link
Mannequin Author

cliffdover88 mannequin commented Oct 21, 2008

Hi

I have a problem with python 2.6, when i try to process strings with
triple-quoted string literal i get an error:

a='a''a' #1 double quoted Ok

a='a''''a' # 2 Ok

a= 'a''''''a' # 3 doble quoted -- SyntaxError: EOF while scanning
triple-quoted string literal

a= 'a''''''''a' # 4 ok

a='a''''''''''a' # 5 same error impair doble quoted

a='a''''''''''''a' # 6 Ok...............

a... #7 error..................

@cliffdover88 cliffdover88 mannequin added stdlib Python modules in the Lib dir build The build process and cross-build labels Oct 21, 2008
@amauryfa
Copy link
Member

All your samples explain easily if you consider that two adjacent string
literals are joined together. (You seem to consider that "double quote"
is a way to insert a quote character. It's not; Python is not Pascal or
SQL)

Your first two examples become:
a='a''a' two adjacent strings == 'aa'
a='a''''a' three adjacent strings ('a' + '' + 'a') == 'aa'

The third is an error:
a='a''''''a' one string ('a') followed by the beginning of a "triple
quoted string" (''') which content starts with the characters (''a') but
does not have a matching (''') to finish the string, hence the Syntax
error.

... and so on. Please have a look at http://docs.python.org/reference/lexical_analysis.html#string-literals

@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
build The build process and cross-build stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

1 participant