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

Inconsistencies in parsing (evaluating?) longstrings #77249

Closed
dlukes mannequin opened this issue Mar 13, 2018 · 3 comments
Closed

Inconsistencies in parsing (evaluating?) longstrings #77249

dlukes mannequin opened this issue Mar 13, 2018 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@dlukes
Copy link
Mannequin

dlukes mannequin commented Mar 13, 2018

BPO 33068
Nosy @serhiy-storchaka, @dlukes

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 2018-03-13.13:07:05.581>
created_at = <Date 2018-03-13.12:50:49.361>
labels = ['interpreter-core', 'invalid']
title = 'Inconsistencies in parsing (evaluating?) longstrings'
updated_at = <Date 2018-03-13.13:52:10.476>
user = 'https://github.com/dlukes'

bugs.python.org fields:

activity = <Date 2018-03-13.13:52:10.476>
actor = 'dlukes'
assignee = 'none'
closed = True
closed_date = <Date 2018-03-13.13:07:05.581>
closer = 'serhiy.storchaka'
components = ['Interpreter Core']
creation = <Date 2018-03-13.12:50:49.361>
creator = 'dlukes'
dependencies = []
files = []
hgrepos = []
issue_num = 33068
keywords = []
message_count = 3.0
messages = ['313745', '313746', '313748']
nosy_count = 2.0
nosy_names = ['serhiy.storchaka', 'dlukes']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue33068'
versions = ['Python 3.6']

@dlukes
Copy link
Mannequin Author

dlukes mannequin commented Mar 13, 2018

""" \""" """ evaluates to ' """ ' (as expected), but without the surrounding spaces, """\"""""" evaluates to '"' instead of '"""'.

Is this expected behavior? If I'm reading the definition of string syntax in https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals correctly, it shouldn't be.

@dlukes dlukes mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Mar 13, 2018
@serhiy-storchaka
Copy link
Member

"""\"""""" is parsed as """\"""" "": a triple-quoted string containing an escaped '"', followed by an empty single-quoted string.

@dlukes
Copy link
Mannequin Author

dlukes mannequin commented Mar 13, 2018

Oh, right, of course! Sorry and thanks for taking the time to clarify that :)

@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
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

1 participant