Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
dcde4941
Commit
dcde4941
authored
Aug 29, 2008
by
Armin Rigo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A collection of crashers, all variants of the idea
of issue #3720.
parent
d4ae97bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
Lib/test/crashers/iter.py
Lib/test/crashers/iter.py
+53
-0
No files found.
Lib/test/crashers/iter.py
0 → 100644
View file @
dcde4941
# Calls to PyIter_Next, or direct calls to tp_iternext, on an object
# which might no longer be an iterable because its 'next' method was
# removed. These are all variants of Issue3720.
"""
Run this script with an argument between 1 and <N> to test for
different crashes.
"""
N
=
8
import
sys
class
Foo
(
object
):
def
__iter__
(
self
):
return
self
def
next
(
self
):
del
Foo
.
next
return
(
1
,
2
)
def
case1
():
list
(
enumerate
(
Foo
()))
def
case2
():
x
,
y
=
Foo
()
def
case3
():
filter
(
None
,
Foo
())
def
case4
():
map
(
None
,
Foo
(),
Foo
())
def
case5
():
max
(
Foo
())
def
case6
():
sum
(
Foo
(),
())
def
case7
():
dict
(
Foo
())
def
case8
():
sys
.
stdout
.
writelines
(
Foo
())
# etc...
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
2
:
print
__doc__
.
replace
(
'<N>'
,
str
(
N
))
else
:
n
=
int
(
sys
.
argv
[
1
])
func
=
globals
()[
'case%d'
%
n
]
func
()
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