Anton Afanasyev added the comment:
Hi Antoine,
my test works for me. It can be either
a = [1, 2, 3]
or
a = iter([1, 2, 3])
, no matter: both objects will be +1 referenced after taking
b = islice(a, 1)
.
My test failed without patch and passed with one.
But your test is more straightforward
Changes by Anton Afanasyev fun@gmail.com:
Added file: http://bugs.python.org/file35087/issue21321_3.4_8c8315bac6a8_4.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21321
Changes by Anton Afanasyev fun@gmail.com:
Added file: http://bugs.python.org/file35086/issue21321_2.7_e3217efa6edd_4.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21321
Anton Afanasyev added the comment:
Hi Antoine,
oops you are right about leaks: fixed them in new attached patch.
As for testing changes in reduce(): they are already covered by
self.pickletest(islice(range(100), *args)). Function pickletest() covers
case for pickle dumping/loading of exhausted
Anton Afanasyev added the comment:
Antoine, not sure about 2.7. The issue first arose for me at Python 2.7, so I
would prefer issue21321_2.7_e3217efa6edd_4.diff patch be applied.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org
Anton Afanasyev added the comment:
Hi Antoine,
I have no found a way to check resource usage in test infrastructure and I
don't think it could be done carefully. The only method I found to test issue
is straightforward: just to check source iterator is not referenced from
itertools.islice
Changes by Anton Afanasyev fun@gmail.com:
Added file: http://bugs.python.org/file35077/issue21321_3.4_8c8315bac6a8_3.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21321
Anton Afanasyev added the comment:
Hi Raymond,
do you mean allocation exceptions handling should be more accurate?
Attaching fixed version for 3.4 branch.
--
Added file: http://bugs.python.org/file35003/issue21321_3.4_8c8315bac6a8_2.diff
___
Python
New submission from Anton Afanasyev:
This issue results in redundant memory consumption for e.g. in this case:
from itertools import *
def test_islice():
items, lookahead = tee(repeat(1, int(1e9)))
lookahead = islice(lookahead, 10
Anton Afanasyev added the comment:
Added patch for 2.7 version (no need to change '__reduce__()' method since it's
not implemented).
--
Added file: http://bugs.python.org/file34991/issue21321_2.7_e3217efa6edd.diff
___
Python tracker rep
10 matches
Mail list logo