[issue15903] Make rawiobase_read() read directly to bytes object

Stefan Krah report at bugs.python.org
Tue Sep 18 10:33:54 CEST 2012


Stefan Krah added the comment:

So the problem is that readinto(view) might result in several references
to view? I don't think that can be solved on the memoryview side.

One could do:

   view = PyMemoryView_FromObject(b);
   // Lie about writability
   ((PyMemoryViewObject *)view)->view.readonly = 0;

   [...]

Then the view owns a reference to the bytes object. But that does not
solve the problem that writable memoryviews based on a readonly object
might be hanging around.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15903>
_______________________________________


More information about the Python-bugs-list mailing list