Message148818
Attached patch modifies the following function to emit a DeprecationWarning:
* PyUnicode_GET_SIZE() (and so PyUnicode_GET_DATA_SIZE())
* PyUnicode_AS_UNICODE()
* PyUnicode_AsUnicodeAndSize() (and so PyUnicode_AsUnicode())
* PyUnicode_FromUnicode()
PyUnicode_GET_SIZE() macro is converted to a function.
The patch adds PyUnicode_AsWideCharAndSize() because PyUnicode_AsUnicodeAndSize() is deprecated and it is still useful to convert a Unicode string to wchar_t* without having to care of freeing the memory.
The patch changes tests to ignore DeprecationWarning.
--
"PyUnicode_AsWideCharAndSize" name is maybe confusing because "PyUnicode_AsWideChar" exists, whereas PyUnicode_AsWideChar() requires to free explicitly the memory.
--
PyUnicode_AsUnicodeAndSize() should maybe fail with an error if the string kind is not PyUnicode_WCHAR_KIND.
--
The CJK codecs should be modified to use the new Unicode API before applying this patch, or test_codecs (and other tests using CJK codecs) would fail with python -Werror. |
|
Date |
User |
Action |
Args |
2011-12-03 19:10:51 | vstinner | set | recipients:
+ vstinner, loewis, ezio.melotti |
2011-12-03 19:10:49 | vstinner | set | messageid: <1322939449.96.0.831797199263.issue13526@psf.upfronthosting.co.za> |
2011-12-03 19:10:49 | vstinner | link | issue13526 messages |
2011-12-03 19:10:49 | vstinner | create | |
|