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
7785fe53
Commit
7785fe53
authored
Mar 12, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attrwrapper.iter*()
hacky (same as the non-iter version) but seems good enough for now
parent
4e9effbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+2
-2
src/runtime/types.cpp
src/runtime/types.cpp
+4
-0
No files found.
src/runtime/objmodel.cpp
View file @
7785fe53
...
...
@@ -1939,8 +1939,8 @@ extern "C" BoxedInt* hash(Box* obj) {
Box
*
hash
=
getclsattr_internal
(
obj
,
"__hash__"
,
NULL
);
if
(
hash
==
NULL
)
{
ASSERT
(
isUserDefined
(
obj
->
cls
)
||
obj
->
cls
==
function_cls
||
obj
->
cls
==
object_cls
||
obj
->
cls
==
classobj
_cls
,
ASSERT
(
isUserDefined
(
obj
->
cls
)
||
obj
->
cls
==
function_cls
||
obj
->
cls
==
object_cls
||
obj
->
cls
==
classobj_cls
||
obj
->
cls
==
module
_cls
,
"%s.__hash__"
,
getTypeName
(
obj
));
// TODO not the best way to handle this...
return
static_cast
<
BoxedInt
*>
(
boxInt
((
i64
)
obj
));
...
...
src/runtime/types.cpp
View file @
7785fe53
...
...
@@ -1927,6 +1927,10 @@ void setupRuntime() {
attrwrapper_cls
->
giveAttr
(
"keys"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
keys
,
LIST
,
1
)));
attrwrapper_cls
->
giveAttr
(
"values"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
values
,
LIST
,
1
)));
attrwrapper_cls
->
giveAttr
(
"items"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
items
,
LIST
,
1
)));
// TODO: not quite right
attrwrapper_cls
->
giveAttr
(
"iterkeys"
,
attrwrapper_cls
->
getattr
(
"keys"
));
attrwrapper_cls
->
giveAttr
(
"itervalues"
,
attrwrapper_cls
->
getattr
(
"values"
));
attrwrapper_cls
->
giveAttr
(
"iteritems"
,
attrwrapper_cls
->
getattr
(
"items"
));
attrwrapper_cls
->
giveAttr
(
"copy"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
copy
,
UNKNOWN
,
1
)));
attrwrapper_cls
->
giveAttr
(
"__len__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
len
,
BOXED_INT
,
1
)));
attrwrapper_cls
->
giveAttr
(
"__iter__"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
AttrWrapper
::
iter
,
UNKNOWN
,
1
)));
...
...
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