Open simonzack opened 9 years ago
As wrapt has a pure Python fallback, if it cannot be done in pure Python now, then wouldn't be able to be universally supported.
Anyway, I will have a dig and see what I can find.
Thanks for considering it, I've come up with a simpler example, btw, I think it's the same underlying problem:
memoryview(wrapt.ObjectProxy(bytearray(b'12345')))
I don't have a good answer of what to do here. What it comes down to is that yes you can likely do it in the C version of the object proxy, but you can't do it in the pure Python code version.
I am somewhat hesitant to implement on the C code side if the same thing can't be done on the pure Python side.
If I ever got a chance, it might be interesting to validate that it can be made to work for the C variant at least, but what you do then I am not sure. One could perhaps have it off by default, but have a way of enabling the support for those who were willing to live with fact that C extension must always exist.
have it off by default, but have a way of enabling the support for those who were willing to live with fact that C extension must always exist
That's definitely good enough to me.
The following raises
TypeError: expected an object with a writable buffer interface
:This is a corner case I've encountered in my own proxy implementation which also doesn't work, and doesn't seem to be possible to wrap in pure python without copying the bytearray. Now that I've discovered
wrapt
which is written inC
. I'm hoping it can be implemented.