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
583c6a3a
Commit
583c6a3a
authored
Nov 20, 2015
by
Kevin Modzelewski
Committed by
Kevin Modzelewski
Nov 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get some internal iterator logic working
parent
4db15e2a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
2 deletions
+21
-2
src/core/types.h
src/core/types.h
+10
-1
src/runtime/inline/xrange.cpp
src/runtime/inline/xrange.cpp
+3
-0
src/runtime/iterators.cpp
src/runtime/iterators.cpp
+7
-0
src/runtime/list.cpp
src/runtime/list.cpp
+1
-1
No files found.
src/core/types.h
View file @
583c6a3a
...
...
@@ -541,7 +541,16 @@ public:
BoxIteratorImpl
*
impl
;
BoxIterator
(
BoxIteratorImpl
*
impl
)
:
impl
(
impl
)
{}
~
BoxIterator
()
=
default
;
BoxIterator
(
const
BoxIterator
&
rhs
)
=
default
;
BoxIterator
(
BoxIterator
&&
rhs
)
{
impl
=
rhs
.
impl
;
rhs
.
impl
=
NULL
;
}
~
BoxIterator
()
{
if
(
impl
)
impl
->~
BoxIteratorImpl
();
}
static
llvm
::
iterator_range
<
BoxIterator
>
getRange
(
Box
*
container
);
bool
operator
==
(
BoxIterator
const
&
rhs
)
const
{
return
impl
->
isSame
(
rhs
.
impl
);
}
...
...
src/runtime/inline/xrange.cpp
View file @
583c6a3a
...
...
@@ -135,7 +135,10 @@ public:
static
void
dealloc
(
Box
*
b
)
noexcept
{
BoxedXrangeIterator
*
self
=
static_cast
<
BoxedXrangeIterator
*>
(
b
);
_PyObject_GC_UNTRACK
(
self
);
Py_DECREF
(
self
->
xrange
);
self
->
cls
->
tp_free
(
self
);
}
static
int
traverse
(
Box
*
s
,
visitproc
visit
,
void
*
arg
)
noexcept
{
BoxedXrangeIterator
*
self
=
static_cast
<
BoxedXrangeIterator
*>
(
s
);
...
...
src/runtime/iterators.cpp
View file @
583c6a3a
...
...
@@ -38,14 +38,21 @@ public:
}
}
~
BoxIteratorGeneric
()
{
assert
(
!
value
);
Py_XDECREF
(
iterator
);
}
void
next
()
override
{
STAT_TIMER
(
t0
,
"us_timer_iteratorgeneric_next"
,
0
);
assert
(
!
value
);
Box
*
next
=
PyIter_Next
(
iterator
);
if
(
next
)
{
value
=
next
;
}
else
{
checkAndThrowCAPIException
();
Py_CLEAR
(
iterator
);
*
this
=
*
end
();
}
}
...
...
src/runtime/list.cpp
View file @
583c6a3a
...
...
@@ -809,7 +809,7 @@ Box* listIAdd(BoxedList* self, Box* _rhs) {
RELEASE_ASSERT
(
_rhs
!=
self
,
"unsupported"
);
for
(
auto
*
b
:
_rhs
->
pyElements
())
listAppendInternal
(
self
,
b
);
listAppendInternal
Stolen
(
self
,
b
);
Py_INCREF
(
self
);
return
self
;
...
...
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