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
ce860949
Commit
ce860949
authored
Aug 13, 2015
by
Vinzenz Feenstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow string + bytearray => bytearray. Fixes #780
parent
8e45b42d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
src/runtime/str.cpp
src/runtime/str.cpp
+10
-4
No files found.
src/runtime/str.cpp
View file @
ce860949
...
@@ -342,11 +342,17 @@ extern "C" Box* strAdd(BoxedString* lhs, Box* _rhs) {
...
@@ -342,11 +342,17 @@ extern "C" Box* strAdd(BoxedString* lhs, Box* _rhs) {
}
}
if
(
!
PyString_Check
(
_rhs
))
{
if
(
!
PyString_Check
(
_rhs
))
{
if
(
PyByteArray_Check
(
_rhs
))
{
Box
*
rtn
=
PyByteArray_Concat
(
lhs
,
_rhs
);
checkAndThrowCAPIException
();
return
rtn
;
}
else
{
// Note: this is deliberately not returning NotImplemented, even though
// Note: this is deliberately not returning NotImplemented, even though
// that would be more usual. I assume this behavior of CPython's is
// that would be more usual. I assume this behavior of CPython's is
// for backwards compatibility.
// for backwards compatibility.
raiseExcHelper
(
TypeError
,
"cannot concatenate 'str' and '%s' objects"
,
getTypeName
(
_rhs
));
raiseExcHelper
(
TypeError
,
"cannot concatenate 'str' and '%s' objects"
,
getTypeName
(
_rhs
));
}
}
}
BoxedString
*
rhs
=
static_cast
<
BoxedString
*>
(
_rhs
);
BoxedString
*
rhs
=
static_cast
<
BoxedString
*>
(
_rhs
);
return
new
(
lhs
->
size
()
+
rhs
->
size
())
BoxedString
(
lhs
->
s
(),
rhs
->
s
());
return
new
(
lhs
->
size
()
+
rhs
->
size
())
BoxedString
(
lhs
->
s
(),
rhs
->
s
());
...
...
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