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 ezio.melotti, loewis, vstinner
Date 2011-12-03.19:10:46
SpamBayes Score 1.6189274e-09
Marked as misclassified No
Message-id <1322939449.96.0.831797199263.issue13526@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-12-03 19:10:51vstinnersetrecipients: + vstinner, loewis, ezio.melotti
2011-12-03 19:10:49vstinnersetmessageid: <1322939449.96.0.831797199263.issue13526@psf.upfronthosting.co.za>
2011-12-03 19:10:49vstinnerlinkissue13526 messages
2011-12-03 19:10:49vstinnercreate