This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Anton.Afanasyev
Recipients Anton.Afanasyev, pitrou, rhettinger
Date 2014-04-28.19:47:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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() after the latter has been exhausted:

a = [random.random() for i in range(10)]
before = sys.getrefcount(a)
b = islice(a, 5)
for i in b: pass
after = sys.getrefcount(a)
self.assertEqual(before, after)

Attaching "issue21321_2.7_e3217efa6edd_3.diff" and "issue21321_3.4_8c8315bac6a8_3.diff" patches with this test included in "Lib/test/".
Date User Action Args
2014-04-28 19:47:57Anton.Afanasyevsetrecipients: + Anton.Afanasyev, rhettinger, pitrou
2014-04-28 19:47:57Anton.Afanasyevsetmessageid: <>
2014-04-28 19:47:57Anton.Afanasyevlinkissue21321 messages
2014-04-28 19:47:57Anton.Afanasyevcreate