Title: Cyclic garbage collection support for slices
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: tim.peters, zseil
Priority: normal Keywords: patch

Created on 2006-06-05 19:15 by zseil, last changed 2006-06-05 21:36 by zseil. This issue is now closed.

File name Uploaded Description Edit
slice_gc_updated.diff zseil, 2006-06-05 21:12 patch against revision 46671
Messages (4)
msg50432 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-06-05 19:15
Slice's members start, stop and step can
be arbitrary python objects, which means
that slices can be easily included in
reference cycles (see the test in the
The patch includes the necessary changes
to enable support for the gc. Since slices
are immutable, there should be no need for
a tp_clear method.
I also changed the slice_dealloc function
to use Py_CLEAR macros instead of Py_DECREF.

I noticed that PySlice_GetIndices is still
missing support for types with a __index__
method. I don't know if that is intentional
or not.
msg50433 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-06-05 21:12
Logged In: YES 

Updated a misleading comment.
msg50434 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2006-06-05 21:27
Logged In: YES 

No offense, but thrust of this seems goofy.  Slice objects
aren't sanely used as containers for arbitrary objects, they
typically hold only integers and maybe None.  The decision
to leave them out of cyclic gc was therefore sensible; that
they can be abused in strained ways to create cycles seems
much more an exercise in determined perverseness than a
practical concern.
msg50435 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-06-05 21:36
Logged In: YES 

OK, closing it.
Date User Action Args
2006-06-05 19:15:06zseilcreate