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
85780479
Commit
85780479
authored
Sep 04, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let str coul multiple with long
parent
84201c50
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
src/capi/abstract.cpp
src/capi/abstract.cpp
+1
-2
src/runtime/str.cpp
src/runtime/str.cpp
+16
-1
No files found.
src/capi/abstract.cpp
View file @
85780479
...
@@ -2071,8 +2071,7 @@ extern "C" PyObject* PyNumber_Long(PyObject* o) noexcept {
...
@@ -2071,8 +2071,7 @@ extern "C" PyObject* PyNumber_Long(PyObject* o) noexcept {
return
res
;
return
res
;
}
}
if
(
PyLong_Check
(
o
))
{
/* A long subclass without nb_long */
if
(
PyLong_Check
(
o
))
{
/* A long subclass without nb_long */
BoxedInt
*
lo
=
(
BoxedInt
*
)
o
;
return
o
;
return
PyLong_FromLong
(
lo
->
n
);
}
}
trunc_func
=
PyObject_GetAttr
(
o
,
trunc_name
);
trunc_func
=
PyObject_GetAttr
(
o
,
trunc_name
);
if
(
trunc_func
)
{
if
(
trunc_func
)
{
...
...
src/runtime/str.cpp
View file @
85780479
...
@@ -1146,9 +1146,24 @@ extern "C" Box* strMul(BoxedString* lhs, Box* rhs) {
...
@@ -1146,9 +1146,24 @@ extern "C" Box* strMul(BoxedString* lhs, Box* rhs) {
assert
(
PyString_Check
(
lhs
));
assert
(
PyString_Check
(
lhs
));
int
n
;
int
n
;
if
(
PyIndex_Check
(
rhs
))
{
Box
*
index
=
PyNumber_Index
(
rhs
);
if
(
PyErr_Occurred
())
{
throwCAPIException
();
}
rhs
=
index
;
}
if
(
PyInt_Check
(
rhs
))
if
(
PyInt_Check
(
rhs
))
n
=
static_cast
<
BoxedInt
*>
(
rhs
)
->
n
;
n
=
static_cast
<
BoxedInt
*>
(
rhs
)
->
n
;
else
else
if
(
isSubclass
(
rhs
->
cls
,
long_cls
))
{
n
=
_PyLong_AsInt
(
rhs
);
if
(
PyErr_Occurred
())
{
PyErr_Clear
();
raiseExcHelper
(
OverflowError
,
"cannot fit 'long' into index-sized integer"
);
}
}
else
return
NotImplemented
;
return
NotImplemented
;
if
(
n
<=
0
)
if
(
n
<=
0
)
return
EmptyString
;
return
EmptyString
;
...
...
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