Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5aa88f09
Commit
5aa88f09
authored
Mar 10, 2000
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Marc-Andre Lemburg: support for Unicode string literals (u"...", ur"...").
parent
09095f3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
Python/compile.c
Python/compile.c
+22
-3
No files found.
Python/compile.c
View file @
5aa88f09
...
...
@@ -875,8 +875,18 @@ parsestr(s)
int
c
;
int
first
=
*
s
;
int
quote
=
first
;
if
(
isalpha
(
quote
)
||
quote
==
'_'
)
quote
=
*++
s
;
int
rawmode
=
0
;
int
unicode
=
0
;
if
(
isalpha
(
quote
)
||
quote
==
'_'
)
{
if
(
quote
==
'u'
||
quote
==
'U'
)
{
quote
=
*++
s
;
unicode
=
1
;
}
if
(
quote
==
'r'
||
quote
==
'R'
)
{
quote
=
*++
s
;
rawmode
=
1
;
}
}
if
(
quote
!=
'\''
&&
quote
!=
'\"'
)
{
PyErr_BadInternalCall
();
return
NULL
;
...
...
@@ -895,8 +905,17 @@ parsestr(s)
return
NULL
;
}
}
if
(
first
!=
quote
||
strchr
(
s
,
'\\'
)
==
NULL
)
if
(
unicode
)
{
if
(
rawmode
)
return
PyUnicode_DecodeRawUnicodeEscape
(
s
,
len
,
NULL
);
else
return
PyUnicode_DecodeUnicodeEscape
(
s
,
len
,
NULL
);
}
else
if
(
rawmode
||
strchr
(
s
,
'\\'
)
==
NULL
)
{
return
PyString_FromStringAndSize
(
s
,
len
);
}
v
=
PyString_FromStringAndSize
((
char
*
)
NULL
,
len
);
p
=
buf
=
PyString_AsString
(
v
);
end
=
s
+
len
;
...
...
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