New submission from Jason R. Coombs <[email protected]>:
When constructing a ctypes.c_char_p with a unicode string, a confusing error
message is reported:
> python -c "import ctypes; ctypes.c_char_p('foo')"
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: string or integer address expected instead of str instance
Since "string" and "str" seem like essentially the same thing, the error
message doesn't make sense.
This message is obviously due to the change to unicode as the default string
instance in Python 3. The error message should probably be updated to read
"bytes or integer address expected instead of a str instance".
It's probably also worth scanning through the ctypes codebase for similar
messages.
----------
components: ctypes
messages: 150271
nosy: jason.coombs
priority: low
severity: normal
status: open
title: TypeError: string or integer address expected instead of str instance
versions: Python 3.2, Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13665>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com