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.

Author sbt
Recipients amaury.forgeotdarc, jcea, pitrou, sbt
Date 2012-09-17.23:04:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347923117.17.0.575227760931.issue15903@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2012-09-17 23:05:17sbtsetrecipients: + sbt, jcea, amaury.forgeotdarc, pitrou
2012-09-17 23:05:17sbtsetmessageid: <1347923117.17.0.575227760931.issue15903@psf.upfronthosting.co.za>
2012-09-17 23:04:56sbtlinkissue15903 messages
2012-09-17 23:04:55sbtcreate