diff options
| author | Benjamin Peterson <benjamin@python.org> | 2016-04-16 21:47:12 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2016-04-16 21:47:12 (GMT) |
| commit | 414f8b937f1ccab9a493b387fa42529416ea1a08 (patch) | |
| tree | 664ee0f250d2e2827260d486987b166645011869 /Lib/test/test_slice.py | |
| parent | 16b83b1f6672e73a7079bb6655354e506ebb1af2 (diff) | |
| download | cpython-414f8b937f1ccab9a493b387fa42529416ea1a08.zip cpython-414f8b937f1ccab9a493b387fa42529416ea1a08.tar.gz cpython-414f8b937f1ccab9a493b387fa42529416ea1a08.tar.bz2 | |
add gc support to slice (closes #26659)
Diffstat (limited to 'Lib/test/test_slice.py')
| -rw-r--r-- | Lib/test/test_slice.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 68518d7..262ee12 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -1,8 +1,10 @@ # tests for slice objects; in particular the indices method. import unittest -from test import test_support +import weakref + from cPickle import loads, dumps +from test import test_support import sys @@ -128,6 +130,15 @@ class SliceTest(unittest.TestCase): self.assertEqual(s.indices(15), t.indices(15)) self.assertNotEqual(id(s), id(t)) + def test_cycle(self): + class myobj(): pass + o = myobj() + o.s = slice(o) + w = weakref.ref(o) + o = None + test_support.gc_collect() + self.assertIsNone(w()) + def test_main(): test_support.run_unittest(SliceTest) |
