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
078c5bfa
Commit
078c5bfa
authored
Feb 11, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert that our return-type annotations are correct
And fix a bunch of places that they weren't.
parent
10067380
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
15 deletions
+20
-15
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+4
-5
src/runtime/builtin_modules/thread.cpp
src/runtime/builtin_modules/thread.cpp
+2
-2
src/runtime/int.cpp
src/runtime/int.cpp
+2
-2
src/runtime/list.cpp
src/runtime/list.cpp
+1
-1
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+10
-4
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+1
-1
No files found.
src/runtime/builtin_modules/builtins.cpp
View file @
078c5bfa
...
...
@@ -1084,10 +1084,9 @@ void setupBuiltins() {
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnumerate
::
new_
,
UNKNOWN
,
3
,
1
,
false
,
false
),
{
boxInt
(
0
)
}));
enumerate_cls
->
giveAttr
(
"__iter__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnumerate
::
iter
,
typeFromClass
(
enumerate_cls
),
1
)));
enumerate_cls
->
giveAttr
(
"next"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnumerate
::
next
,
typeFromClass
(
enumerate_cls
),
1
)));
enumerate_cls
->
giveAttr
(
"__hasnext__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnumerate
::
hasnext
,
typeFromClass
(
enumerate_cls
),
1
)));
enumerate_cls
->
giveAttr
(
"next"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnumerate
::
next
,
BOXED_TUPLE
,
1
)));
enumerate_cls
->
giveAttr
(
"__hasnext__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedEnumerate
::
hasnext
,
BOXED_BOOL
,
1
)));
enumerate_cls
->
freeze
();
builtins_module
->
giveAttr
(
"enumerate"
,
enumerate_cls
);
...
...
@@ -1130,7 +1129,7 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"dir"
,
new
BoxedBuiltinFunctionOrMethod
(
boxRTFunction
((
void
*
)
dir
,
LIST
,
1
,
1
,
false
,
false
),
{
NULL
}));
builtins_module
->
giveAttr
(
"vars"
,
new
BoxedBuiltinFunctionOrMethod
(
boxRTFunction
((
void
*
)
vars
,
LIST
,
1
,
1
,
false
,
false
),
{
NULL
}));
"vars"
,
new
BoxedBuiltinFunctionOrMethod
(
boxRTFunction
((
void
*
)
vars
,
UNKNOWN
,
1
,
1
,
false
,
false
),
{
NULL
}));
builtins_module
->
giveAttr
(
"object"
,
object_cls
);
builtins_module
->
giveAttr
(
"str"
,
str_cls
);
builtins_module
->
giveAttr
(
"basestring"
,
basestring_cls
);
...
...
src/runtime/builtin_modules/thread.cpp
View file @
078c5bfa
...
...
@@ -149,8 +149,8 @@ void setupThread() {
thread_lock_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
sizeof
(
BoxedThreadLock
),
false
,
"lock"
);
thread_lock_cls
->
giveAttr
(
"__module__"
,
boxStrConstant
(
"thread"
));
thread_lock_cls
->
giveAttr
(
"acquire"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedThreadLock
::
acquire
,
NONE
,
2
,
1
,
false
,
false
),
{
boxInt
(
1
)
}));
"acquire"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedThreadLock
::
acquire
,
BOXED_BOOL
,
2
,
1
,
false
,
false
),
{
boxInt
(
1
)
}));
thread_lock_cls
->
giveAttr
(
"release"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedThreadLock
::
release
,
NONE
,
1
)));
thread_lock_cls
->
giveAttr
(
"acquire_lock"
,
thread_lock_cls
->
getattr
(
"acquire"
));
thread_lock_cls
->
giveAttr
(
"release_lock"
,
thread_lock_cls
->
getattr
(
"release"
));
...
...
src/runtime/int.cpp
View file @
078c5bfa
...
...
@@ -863,13 +863,13 @@ void setupInt() {
int_cls
->
giveAttr
(
"__nonzero__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNonzero
,
BOXED_BOOL
,
1
)));
int_cls
->
giveAttr
(
"__repr__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intRepr
,
STR
,
1
)));
int_cls
->
giveAttr
(
"__hash__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intHash
,
BOXED_INT
,
1
)));
int_cls
->
giveAttr
(
"__divmod__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intDivmod
,
BOXED_TUPLE
,
2
)));
int_cls
->
giveAttr
(
"__divmod__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intDivmod
,
UNKNOWN
,
2
)));
int_cls
->
giveAttr
(
"__hex__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intHex
,
STR
,
1
)));
int_cls
->
giveAttr
(
"__oct__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intOct
,
STR
,
1
)));
int_cls
->
giveAttr
(
"__new__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNew
,
BOXED_INT
,
2
,
1
,
false
,
false
),
{
boxInt
(
0
)
}));
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intNew
,
UNKNOWN
,
2
,
1
,
false
,
false
),
{
boxInt
(
0
)
}));
int_cls
->
giveAttr
(
"__init__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
intInit
,
NONE
,
2
,
1
,
true
,
false
),
{
boxInt
(
0
)
}));
...
...
src/runtime/list.cpp
View file @
078c5bfa
...
...
@@ -762,7 +762,7 @@ void setupList() {
list_cls
->
giveAttr
(
"pop"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listPop
,
UNKNOWN
,
2
,
1
,
false
,
false
),
{
None
}));
list_cls
->
giveAttr
(
"append"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listAppend
,
NONE
,
2
)));
list_cls
->
giveAttr
(
"extend"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listIAdd
,
NONE
,
2
)));
list_cls
->
giveAttr
(
"extend"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
listIAdd
,
LIST
,
2
)));
CLFunction
*
setitem
=
createRTFunction
(
3
,
0
,
false
,
false
);
addRTFunction
(
setitem
,
(
void
*
)
listSetitemInt
,
NONE
,
std
::
vector
<
ConcreteCompilerType
*>
{
LIST
,
BOXED_INT
,
UNKNOWN
});
...
...
src/runtime/objmodel.cpp
View file @
078c5bfa
...
...
@@ -2684,14 +2684,20 @@ Box* callCLFunc(CLFunction* f, CallRewriteArgs* rewrite_args, int num_output_arg
rewrite_args
->
out_success
=
true
;
}
Box
*
r
;
if
(
closure
&&
generator
)
r
eturn
chosen_cf
->
closure_generator_call
(
closure
,
generator
,
oarg1
,
oarg2
,
oarg3
,
oargs
);
r
=
chosen_cf
->
closure_generator_call
(
closure
,
generator
,
oarg1
,
oarg2
,
oarg3
,
oargs
);
else
if
(
closure
)
r
eturn
chosen_cf
->
closure_call
(
closure
,
oarg1
,
oarg2
,
oarg3
,
oargs
);
r
=
chosen_cf
->
closure_call
(
closure
,
oarg1
,
oarg2
,
oarg3
,
oargs
);
else
if
(
generator
)
r
eturn
chosen_cf
->
generator_call
(
generator
,
oarg1
,
oarg2
,
oarg3
,
oargs
);
r
=
chosen_cf
->
generator_call
(
generator
,
oarg1
,
oarg2
,
oarg3
,
oargs
);
else
return
chosen_cf
->
call
(
oarg1
,
oarg2
,
oarg3
,
oargs
);
r
=
chosen_cf
->
call
(
oarg1
,
oarg2
,
oarg3
,
oargs
);
ASSERT
(
chosen_cf
->
spec
->
rtn_type
->
isFitBy
(
r
->
cls
),
"%s (%p) %s %s"
,
g
.
func_addr_registry
.
getFuncNameAtAddress
(
chosen_cf
->
code
,
true
,
NULL
).
c_str
(),
chosen_cf
->
code
,
chosen_cf
->
spec
->
rtn_type
->
debugName
().
c_str
(),
r
->
cls
->
tp_name
);
return
r
;
}
...
...
src/runtime/tuple.cpp
View file @
078c5bfa
...
...
@@ -388,7 +388,7 @@ void setupTuple() {
CLFunction
*
getitem
=
createRTFunction
(
2
,
0
,
0
,
0
);
addRTFunction
(
getitem
,
(
void
*
)
tupleGetitemInt
,
UNKNOWN
,
std
::
vector
<
ConcreteCompilerType
*>
{
BOXED_TUPLE
,
BOXED_INT
});
addRTFunction
(
getitem
,
(
void
*
)
tupleGetitemSlice
,
SLICE
,
std
::
vector
<
ConcreteCompilerType
*>
{
BOXED_TUPLE
,
SLICE
});
addRTFunction
(
getitem
,
(
void
*
)
tupleGetitemSlice
,
UNKNOWN
,
std
::
vector
<
ConcreteCompilerType
*>
{
BOXED_TUPLE
,
SLICE
});
addRTFunction
(
getitem
,
(
void
*
)
tupleGetitem
,
UNKNOWN
,
std
::
vector
<
ConcreteCompilerType
*>
{
BOXED_TUPLE
,
UNKNOWN
});
tuple_cls
->
giveAttr
(
"__getitem__"
,
new
BoxedFunction
(
getitem
));
...
...
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