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 vstinner
Recipients Arfrever, amaury.forgeotdarc, eric.araujo, ezio.melotti, pitrou, vstinner
Date 2010-08-08.13:16:10
SpamBayes Score 4.519718e-13
Marked as misclassified No
Message-id <>
pyerr_warnformat.patch: create PyErr_WarnFormat() function, and use it in PyType_Ready() and PyUnicode_AsEncodedString(). The patch fixes also setup_context(): work on the unicode filename, not the encoded (bytes) filename. It does fix a bug because len is a number of characters, not a number of bytes: the number of bytes is bigger than the number of characters if the filename contains a non-ASCII character.

Advantages of PyErr_WarnFormat() over PyOS_snprintf() + PyErr_WarnEx():
 - it avoids the create a temporary byte buffer: use directly an unicode buffer,
 - it accepts Python (unicode) formatters like %U,
 - it avoids the usage of a fixed size buffer allocated on the stack (which may be too big).

Differences with Rietveld's version: rename PyErr_WarnUnicode() to warn_unicode() (it's now a static function) and document PyErr_WarnFormat().
Date User Action Args
2010-08-08 13:16:16vstinnersetrecipients: + vstinner, amaury.forgeotdarc, pitrou, ezio.melotti, eric.araujo, Arfrever
2010-08-08 13:16:16vstinnersetmessageid: <>
2010-08-08 13:16:14vstinnerlinkissue9425 messages
2010-08-08 13:16:14vstinnercreate