[issue12340] Access violation when using the C version of the io module

2013-10-25 Thread OscarL

OscarL added the comment:

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?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12340
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12340] Access violation when using the C version of the io module

2011-06-15 Thread OscarL

New submission from OscarL oscar.le...@gmail.com:

This is on Windows XP SP2. Using Python 2.7.1 and 2.7.2.

While executing the unit tests of the PySerial package, version 2.5 
(http://pypi.python.org/pypi/pyserial) one of the tests fails when using the C 
version of the io module (io), but pass if the pure Python version is used 
(_pyio.py).

The specific test case in question is: test_iolib.py. When executed like:

 python test_iolib.py loop://

the test fails with the following traceback:


Traceback (most recent call last):
  File C:\pyserial-2.5\test\test_iolib.py, line 68, in test_hello_raw

self.failUnlessEqual(hello, unicode(hello\n))
AssertionError: u'memory at 0x00C5D940' != u'hello\n'


And Windows shows a crash report dialog, with the following information:


AppName: python.exe  AppVer: 0.0.0.0 ModName: python27.dll
ModVer: 2.7.2150.1013Offset: 00089f57

Exception Information
Code: 0xc005Flags: 0x
Record: 0x  Address: 0x1e089f57


As said above, if in the said test case, instead of import io one does 
import _pyio as io, the crash does not happens, and the test succeeds.

--
components: IO
messages: 138382
nosy: OscarL
priority: normal
severity: normal
status: open
title: Access violation when using the C version of the io module
type: crash
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12340
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com