Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
1af19b2a
Commit
1af19b2a
authored
Jun 18, 2014
by
xiafan_linux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the bug of strRepr. Now single quote is escaped correctly
parent
4da376b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
src/core/threading.cpp
src/core/threading.cpp
+1
-1
src/runtime/str.cpp
src/runtime/str.cpp
+7
-3
test/tests/repr.py
test/tests/repr.py
+9
-0
No files found.
src/core/threading.cpp
View file @
1af19b2a
...
...
@@ -148,7 +148,7 @@ static void _thread_context_dump(int signum, siginfo_t* info, void* _context) {
if
(
VERBOSITY
()
>=
2
)
{
printf
(
"in thread_context_dump, tid=%d
\n
"
,
tid
);
printf
(
"%p %p %p
\n
"
,
context
,
&
context
,
context
->
uc_mcontext
.
fpregs
);
printf
(
"old rip: 0x%lx
\n
"
,
context
->
uc_mcontext
.
gregs
[
REG_RIP
]);
printf
(
"old rip: 0x%l
l
x
\n
"
,
context
->
uc_mcontext
.
gregs
[
REG_RIP
]);
}
pushThreadState
(
tid
,
context
);
...
...
src/runtime/str.cpp
View file @
1af19b2a
...
...
@@ -237,10 +237,14 @@ extern "C" Box* strRepr(BoxedString* self) {
std
::
ostringstream
os
(
""
);
const
std
::
string
&
s
=
self
->
s
;
os
<<
'\''
;
char
quote
=
'\''
;
if
(
s
.
find
(
'\''
,
0
)
!=
std
::
string
::
npos
&&
s
.
find
(
'\"'
,
0
)
==
std
::
string
::
npos
)
{
quote
=
'\"'
;
}
os
<<
quote
;
for
(
int
i
=
0
;
i
<
s
.
size
();
i
++
)
{
char
c
=
s
[
i
];
if
(
!
_needs_escaping
[
c
&
0xff
])
{
if
(
(
c
==
'\''
&&
quote
==
'\"'
)
||
!
_needs_escaping
[
c
&
0xff
])
{
os
<<
c
;
}
else
{
char
special
=
0
;
...
...
@@ -275,7 +279,7 @@ extern "C" Box* strRepr(BoxedString* self) {
}
}
}
os
<<
'\''
;
os
<<
quote
;
return
boxString
(
os
.
str
());
}
...
...
test/tests/repr.py
0 → 100644
View file @
1af19b2a
a
=
1
try
:
a
.
b
except
AttributeError
,
e
:
print
repr
(
e
)
print
repr
(
"both
\
'
\
"
quotes"
)
print
repr
(
"single
\
'
quote"
)
print
repr
(
"double
\
"
quote"
)
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