Message130229
In Python 3.1.3, (c_char*5).from_buffer(b'abcde') worked. In 3.2 it fails with "TypeError: expected an object with a writable buffer interface".
This seems to represent a significant decrease in the functionality of ctypes, since, if I understand correctly, it has no notion of a const array or a const char. I used from_buffer with a bytes argument in 3.1 and it was far from obvious how to port to 3.2 without introducing expensive copying. I understand the motivation behind requiring a writable buffer, but I think it's a bad idea. If you take this to its logical conclusion, it should not be possible to pass bytes or str values directly to C functions, since there's no way to be sure they won't write through the pointer. |
|
Date |
User |
Action |
Args |
2011-03-07 07:11:25 | benrg | set | recipients:
+ benrg, theller |
2011-03-07 07:11:25 | benrg | set | messageid: <1299481885.21.0.0627562040827.issue11427@psf.upfronthosting.co.za> |
2011-03-07 07:11:24 | benrg | link | issue11427 messages |
2011-03-07 07:11:24 | benrg | create | |
|