]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/test/crashers/mutation_inside_cyclegc.py
82ee72d08fcf896b79280a71bed49ad67907d5c7
2 # The cycle GC collector can be executed when any GC-tracked object is
3 # allocated, e.g. during a call to PyList_New(), PyDict_New(), ...
4 # Moreover, it can invoke arbitrary Python code via a weakref callback.
5 # This means that there are many places in the source where an arbitrary
6 # mutation could unexpectedly occur.
8 # The example below shows list_slice() not expecting the call to
9 # PyList_New to mutate the input list. (Of course there are many
10 # more examples like this one.)
28 keepalive
.append(weakref
.ref(a
, callback
))
31 keepalive
.append(lst
[:])