Message139320
Using Python reference counting and the garbage collector to control
when PyBuffer_Release is called has problems. First, it assumes the
CPython interpreter will always use reference counting. Second,
PyBuffer_Release may never get called if circular references exist.
Third, an exception could keep a memoryview object alive in a traceback,
delaying the PyBuffer_Release call. Finally, it does not play well with
the memoryview __enter__, __exit__, and release methods. It makes Python
level context management pointless; instead, just del the memoryview
instance and hope the garbage collector cooperates. For the old buffer
protocol and the Numpy array interface, resources have to be released in
an object's destructor at garbage collection time. There is no other
choice. If that also becomes the case for the new buffer protocol, then
there is little incentive to migrate to it. |
|
Date |
User |
Action |
Args |
2011-06-27 18:14:37 | kermode | set | recipients:
+ kermode, teoliphant, mark.dickinson, ncoghlan, rupole, pitrou, pv, skrah, jcon, petri.lehtinen |
2011-06-27 18:14:36 | kermode | link | issue10181 messages |
2011-06-27 18:14:36 | kermode | create | |
|