Created
June 14, 2013 20:24
-
-
Save cpdean/5784980 to your computer and use it in GitHub Desktop.
demonstrates a segfault on python 2.7.3 and python 3.2.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools, timeit | |
import sys | |
if sys.version_info < (3,): | |
range = xrange | |
a = (i for i in range(11**7)); b,c = itertools.tee(a) | |
print(timeit.timeit(lambda : sum(b), number=1)) | |
# this line segfaults: | |
a = (i for i in range(11**7)); b,c = itertools.tee(a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment