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 jaraco
Recipients jaraco
Date 2011-12-26.17:50:34
SpamBayes Score 2.6145752e-14
Marked as misclassified No
Message-id <1324921834.92.0.644281007494.issue13665@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-12-26 17:50:35jaracosetrecipients: + jaraco
2011-12-26 17:50:34jaracosetmessageid: <1324921834.92.0.644281007494.issue13665@psf.upfronthosting.co.za>
2011-12-26 17:50:34jaracolinkissue13665 messages
2011-12-26 17:50:34jaracocreate