➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 skrah
收信人 Alexander.Belopolsky, belopolsky, docs@python, ncoghlan, pitrou, skrah
日期 2012-08-31.18:34:39
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1346438083.63.0.144847991141.issue15821@psf.upfronthosting.co.za>
In-reply-to
内容
Alexander, your test case is brilliant and could eventually go into
_testbuffer.c, but I'd prefer a simpler test case for now. :)

Here's a patch that restores the info.obj cleanup facility.

I intentionally did not add copying the format in order to keep the
diff small (in case this can go into rc2). Crashing on stack addresses
for format is not a regression.


Apparently PyMemoryView_FromBuffer() is used for low level tinkering and
automatic cleanup, so I now think that it's better not to break backwards
compatibility, i.e. leave the value of info.obj untouched.

Otherwise people using the cleanup facility will have reference leaks.


However, I don't like the interface at all: Passing a pointer to a struct
and then relying on the fact that *some* values are copied (shape, strides
and suboffsets) but not others (format, buf) is counterintuitive.


With the ManagedBuffer, we could now write a new function that returns
a memoryview with much nicer cleanup facilities. But that doesn't help
here since we're stuck with this function for 3.3.0.


What do you think? Should this go into 3.3.0? The changes to memoryobject.c
are minimal, the rest are tests and docs.
历史
日期 用户 动作 参数
2012-08-31 18:34:43skrah修改recipients: + skrah, ncoghlan, belopolsky, pitrou, Alexander.Belopolsky, docs@python
2012-08-31 18:34:43skrah修改messageid: <1346438083.63.0.144847991141.issue15821@psf.upfronthosting.co.za>
2012-08-31 18:34:42skrah链接issue15821 messages
2012-08-31 18:34:41skrah创建