← 输入框|bugs.python.org|刷新

➜

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.

作者 sbt
收信人 amaury.forgeotdarc, jcea, pitrou, sbt
日期 2012-09-17.23:04:55
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1347923117.17.0.575227760931.issue15903@psf.upfronthosting.co.za>
In-reply-to
内容
> I think that's a useless precaution. The bytes object cannot "leak" 
> since you are using PyMemoryView_FromMemory(), which doesn't know about 
> the original object.

The bytes object cannot "leak" so, as you say, checking that refcount is pointless.  But the view might "leak", and since it does not own a reference to the base object we have a problem: we can't deallocate the bytes object for fear of breaking the view.

It looks like objects returned by PyMemoryView_FromMemory() must never be allowed to "leak", so I am not sure there are many circumstances in which PyMemoryView_FromMemory() is safe to use.

Perhaps using PyBuffer_FillInfo() and PyMemory_FromBuffer() would keep alive the bytes object while the view is alive, without letting the bytes object "leak".

> Out of curiousity, have you done any benchmarks?

No.
历史
日期 用户 动作 参数
2012-09-17 23:05:17sbt修改recipients: + sbt, jcea, amaury.forgeotdarc, pitrou
2012-09-17 23:05:17sbt修改messageid: <1347923117.17.0.575227760931.issue15903@psf.upfronthosting.co.za>
2012-09-17 23:04:56sbt链接issue15903 messages
2012-09-17 23:04:55sbt创建