[issue6239] c_char_p return value returns string, not bytes

2009-09-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Commited as svn rev 74664 (py3k) and rev 74665 (release31-maint). @theller: Cool, thanks ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6239

[issue6239] c_char_p return value returns string, not bytes

2009-09-04 Thread Thomas Heller
Thomas Heller thel...@ctypes.org added the comment: Commited as svn rev 74664 (py3k) and rev 74665 (release31-maint). -- stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue6239] c_char_p return value returns string, not bytes

2009-09-01 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Assigning back to Thomas for commit. -- assignee: benjamin.peterson - theller resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6239

[issue6239] c_char_p return value returns string, not bytes

2009-08-22 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: wrote an extension application which relies on the patch (works after applying patch to python 3.1.1). it converts png images to colorized ascii-art on ansi-compatible terminal. requires the patch b/c a ctype function returns a c-string w/

[issue6239] c_char_p return value returns string, not bytes

2009-08-22 Thread kai zhu
Changes by kai zhu kaizhu...@gmail.com: Added file: http://bugs.python.org/file14769/_asciiporn.h ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6239 ___

[issue6239] c_char_p return value returns string, not bytes

2009-08-21 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: i just found this bug independently, but yes its a bug, which i hope gets fixed for sake of extension community: // test.c beg char s[4] = ab\xff; char *foo() { return s; } // test.c end $ gcc -fPIC -g -c -Wall test.c $ gcc -shared test.o -o

[issue6239] c_char_p return value returns string, not bytes

2009-08-15 Thread Thomas Heller
Thomas Heller thel...@ctypes.org added the comment: I agree that the C type 'char' is a byte, not a character. So Python3 should creates a Python bytes object for the ctypes c_char_p type. Since Python 3.1 is out, is it too late to change it in the 3.x branch? :-) Maybe for Python 3.2? I

[issue6239] c_char_p return value returns string, not bytes

2009-08-15 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: I agree that it's a bug. Letting Benjamin decide whether to put it in 3.1.1 :) -- assignee: theller - benjamin.peterson nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org

[issue6239] c_char_p return value returns string, not bytes

2009-08-15 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Sounds ok to me. 2009/8/15 Georg Brandl rep...@bugs.python.org: Georg Brandl ge...@python.org added the comment: I agree that it's a bug.  Letting Benjamin decide whether to put it in 3.1.1 :) -- assignee: theller -

[issue6239] c_char_p return value returns string, not bytes

2009-08-15 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I agree that it's a bug. Letting Benjamin decide whether to put it in 3.1.1 :) And what about 3.0.x? Is this branch still alive or not? -- ___ Python tracker rep...@bugs.python.org

[issue6239] c_char_p return value returns string, not bytes

2009-08-15 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: 2009/8/15 STINNER Victor rep...@bugs.python.org: STINNER Victor victor.stin...@haypocalc.com added the comment: I agree that it's a bug. Letting Benjamin decide whether to put it in 3.1.1 :) And what about 3.0.x? Is this branch

[issue6239] c_char_p return value returns string, not bytes

2009-08-14 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I agree that the C type 'char' is a byte, not a character. So Python3 should creates a Python bytes object for the ctypes c_char_p type. Since Python 3.1 is out, is it too late to change it in the 3.x branch? :-) Maybe for Python

[issue6239] c_char_p return value returns string, not bytes

2009-07-31 Thread Thomas Heller
Thomas Heller thel...@ctypes.org added the comment: Here's a patch. -- keywords: +patch Added file: http://bugs.python.org/file14615/c_char_p.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6239

[issue6239] c_char_p return value returns string, not bytes

2009-06-08 Thread Georg Brandl
New submission from Georg Brandl ge...@python.org: If you assign a function a restype of c_char_p, you get back a Unicode string, but you should get a bytes object. from ctypes import * strchr = cdll['libc.so.6'].strchr strchr.restype = c_char_p strchr.argtypes = [c_char_p, c_char]