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 georg.brandl
Recipients georg.brandl, theller
Date 2009-06-08.16:07:28
SpamBayes Score 0.00016602689
Marked as misclassified No
Message-id <1244477249.92.0.44777371921.issue6239@psf.upfronthosting.co.za>
In-reply-to
Content
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]
>>> strchr(b'abcde', b'd')
'de'
History
Date User Action Args
2009-06-08 16:07:30georg.brandlsetrecipients: + georg.brandl, theller
2009-06-08 16:07:29georg.brandlsetmessageid: <1244477249.92.0.44777371921.issue6239@psf.upfronthosting.co.za>
2009-06-08 16:07:28georg.brandllinkissue6239 messages
2009-06-08 16:07:28georg.brandlcreate