Message113259
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:16 | vstinner | set | recipients:
+ vstinner, amaury.forgeotdarc, pitrou, ezio.melotti, eric.araujo, Arfrever |
2010-08-08 13:16:16 | vstinner | set | messageid: <1281273376.83.0.0837651873041.issue9425@psf.upfronthosting.co.za> |
2010-08-08 13:16:14 | vstinner | link | issue9425 messages |
2010-08-08 13:16:14 | vstinner | create | |
|