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
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
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
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/
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
___
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
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
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
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 -
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
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
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
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
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]
14 matches
Mail list logo