◐ Shell
clean mode source ↗

Message 170627 - Python tracker

> If either refcount is larger than the expected value of 1, then the
> data is copied rather than resized.

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.

Out of curiousity, have you done any benchmarks?