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
065ac619
Commit
065ac619
authored
Dec 21, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing int attributes compared with CPython
parent
bd361100
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
281 additions
and
5 deletions
+281
-5
src/runtime/int.cpp
src/runtime/int.cpp
+242
-5
test/tests/intmethods.py
test/tests/intmethods.py
+39
-0
No files found.
src/runtime/int.cpp
View file @
065ac619
This diff is collapsed.
Click to expand it.
test/tests/intmethods.py
View file @
065ac619
...
...
@@ -178,3 +178,42 @@ if sys.version_info >= (2, 7, 6):
print
(
e
.
message
)
else
:
print
(
"int() missing string argument"
)
unary_test_data
=
[
-
42
,
-
0
,
0
,
42
]
for
i
in
unary_test_data
:
print
(
int
.
__abs__
(
i
))
print
(
int
.
__long__
(
i
))
data
=
[
"-1"
,
"0"
,
"1"
,
"5"
,
"-5"
,
"5.0"
,
"5L"
,
"0L"
,
"5+5j"
,
"0.0"
,
"
\
"
5
\
"
"
,
"None"
,
]
operations
=
[
"__radd__"
,
"__rand__"
,
"__ror__"
,
"__rxor__"
,
"__rsub__"
,
"__rmul__"
,
"__rdiv__"
,
"__rfloordiv__"
,
"__rpow__"
,
"__rmod__"
,
"__rdivmod__"
,
"__rtruediv__"
,
"__rrshift__"
,
"__rlshift__"
,
"__coerce__"
,
]
for
x
in
data
:
for
y
in
data
:
for
operation
in
operations
:
try
:
print
(
eval
(
"int.{op}({arg1}, {arg2})"
.
format
(
op
=
operation
,
arg1
=
x
,
arg2
=
y
)))
except
Exception
as
e
:
print
(
e
.
message
)
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