Closed wolfmanstout closed 1 year ago
FYI, this will be more efficient (and maybe avoid the crash?) if an object that supports the buffer protocol is passed instead of a list.
data_writer.write_bytes(10000000 * b'\x00')
But we should still fix the crash.
Bug was introduce by https://github.com/pywinrt/pywinrt/commit/9564a9964f29eb6af8639fa1a44654a2f5d8c6ea. Returning com_array
as array_view
apparently frees the underlying buffer since array_view
doesn't have a move constructor.
Thank you for looking into this! FWIW, winrt actually doesn't allow passing in a bytes object as you suggest (although it does seem to resolve the issue with winsdk). winrt gives the following error:
>>> data_writer.write_bytes(10000000 * b'\x00')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: The parameter is incorrect.
I only mention this in case the goal is to provide an identical drop-in replacement for winrt.
Hi, when is your ETA on pushing out a new release with the fix? I had another bug filed from a user of my package concerned about winrt being unmaintained, and this is the only blocker for me to switch over. Thanks!
I've been putting off doing a release because there have been some breaking changes and I haven't decided yet if the tradeoffs of the performance improvements are worth the breaking changes yet or not. Hopefully I can find some time to come back to this again soonish.
Should be fixed in v1.0.0b8. Note that write_bytes()
now takes a bytes-like object instead of a list.
Simple repro on Windows 11 Python 3.9 64-bit:
This works fine with winrt. Try doing 100 MB if that doesn't repro.
Event Viewer log: