Fix cython's gc_track and gc_untrack

Imported from <a href="http://trac.sagemath.org/sage_trac/ticket/13896">trac #13896</a>.

Robert's cython test case (I spent quite some time twice to find it, so I'm storing it here for future reference)

Reported by: nbruin

Component: memleak

CC: SimonKing,, jpflori

Report Upstream: Completely fixed; Fix reported upstream

Authors: Robert Bradshaw

Dependencies: 

Work issues: 

Reviewers: Jeroen Demeyer

Merged in: sage-5.6.beta3

Attachments: <ol><li><a href="http://trac.sagemath.org/sage_trac/attachment/ticket/13896/double-free-crash.patch">double-free-crash.patch: Patch to more reliably produce crash</a> by nbruin at 20130101T18:53:17</li><li><a href="http://trac.sagemath.org/sage_trac/attachment/ticket/13896/cython-0.17.3.p0.diff">cython-0.17.3.p0.diff: </a> by jpflori at 20130102T19:54:51</li><li><a href="http://trac.sagemath.org/sage_trac/attachment/ticket/13896/double_dealloc_T796.pyx">double_dealloc_T796.pyx: Robert's cython test case (I spent quite some time twice to find it, so I'm storing it here for future reference)</a> by nbruin at 20130103T21:09:37</li></ol>