Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
e2a245cb
Commit
e2a245cb
authored
Sep 12, 2015
by
Jelle Zijlstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
f-string parsing: fix bugs
parent
1af7483c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-2
No files found.
Cython/Compiler/Parsing.py
View file @
e2a245cb
...
@@ -898,7 +898,7 @@ def p_string_literal(s, kind_override=None):
...
@@ -898,7 +898,7 @@ def p_string_literal(s, kind_override=None):
else
:
else
:
if
kind_override
is
not
None
and
kind_override
in
'ub'
:
if
kind_override
is
not
None
and
kind_override
in
'ub'
:
kind
=
kind_override
kind
=
kind_override
if
kind
in
'uf'
:
# f-strings are scanned exactly like Unicode literals, but are parsed further later
if
kind
in
{
'u'
,
'f'
}
:
# f-strings are scanned exactly like Unicode literals, but are parsed further later
chars
=
StringEncoding
.
UnicodeLiteralBuilder
()
chars
=
StringEncoding
.
UnicodeLiteralBuilder
()
elif
kind
==
''
:
elif
kind
==
''
:
chars
=
StringEncoding
.
StrLiteralBuilder
(
s
.
source_encoding
)
chars
=
StringEncoding
.
StrLiteralBuilder
(
s
.
source_encoding
)
...
@@ -1122,7 +1122,7 @@ def p_f_string_expr(s, unicode_value, pos, starting_index):
...
@@ -1122,7 +1122,7 @@ def p_f_string_expr(s, unicode_value, pos, starting_index):
# the format spec is itself treated like an f-string
# the format spec is itself treated like an f-string
if
format_spec_str
is
not
None
:
if
format_spec_str
is
not
None
:
format_spec
=
p_f_string
(
s
,
format_spec_str
,
pos
)
format_spec
=
ExprNodes
.
JoinedStrNode
(
pos
,
values
=
p_f_string
(
s
,
format_spec_str
,
pos
)
)
else
:
else
:
format_spec
=
None
format_spec
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment