Message170628
| 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:17 | sbt | set | recipients:
+ sbt, jcea, amaury.forgeotdarc, pitrou |
| 2012年09月17日 23:05:17 | sbt | set | messageid: <1347923117.17.0.575227760931.issue15903@psf.upfronthosting.co.za> |
| 2012年09月17日 23:04:56 | sbt | link | issue15903 messages |
| 2012年09月17日 23:04:55 | sbt | create |
|