This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author OscarL
Recipients OscarL, benjamin.peterson, christian.heimes, pitrou, santoso.wijaya
Date 2013-10-25.14:33:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382711606.58.0.151189686921.issue12340@psf.upfronthosting.co.za>
In-reply-to
Content
I can't reproduce the access violation on Windows, using Python 2.7.3.

Using the test_bufio.py script by santa4nt, I can see that the fail still happens.

As Santoso Wijaya (santa4nt) said in a previous comment:

The `write(data)` method is getting a `memoryview` object, thus the test code should be using `data.tobytes()` instead of using `bytes(data)`. If we introduce that logic on the test_bufio.py script it passes.

The thing is that if we, instead of doing `import io` (the C version of the module) we do `import _pyio as io` (the pure Python version) the FAIL does not appears at all in the original script!

That difference ("`write` might receive a `memoryview` object if using the C version of this module") is not documented anywhere.

It should, if that's the expected behavior [*], and the code using the io module is responsible for using .tobytes() instead of bytes().

[*] Why "_pyio.py" behaves differently?
History
Date User Action Args
2013-10-25 14:33:26OscarLsetrecipients: + OscarL, pitrou, christian.heimes, benjamin.peterson, santoso.wijaya
2013-10-25 14:33:26OscarLsetmessageid: <1382711606.58.0.151189686921.issue12340@psf.upfronthosting.co.za>
2013-10-25 14:33:26OscarLlinkissue12340 messages
2013-10-25 14:33:26OscarLcreate