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.
Created on 2011年12月03日 19:10 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| unicode_warn_deprecate.patch | vstinner, 2011年12月03日 19:10 | review | ||
| Messages (5) | |||
|---|---|---|---|
| msg148818 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年12月03日 19:10 | |
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. |
|||
| msg148819 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年12月03日 19:47 | |
I'm not sure it is customary for C APIs to emit deprecation warnings. |
|||
| msg148838 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2011年12月04日 05:16 | |
Quoting the PEP "While the Py_UNICODE representation and APIs are deprecated with this PEP, no removal of the respective APIs is scheduled. The APIs should remain available at least five years after the PEP is accepted" I don't think there should be warnings. |
|||
| msg148843 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2011年12月04日 08:40 | |
I agree with Benjamin. |
|||
| msg148848 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2011年12月04日 09:27 | |
Closing this as rejected, for the reasons given. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:24 | admin | set | github: 57735 |
| 2011年12月04日 09:27:50 | loewis | set | status: open -> closed resolution: rejected messages: + msg148848 |
| 2011年12月04日 08:40:06 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg148843 |
| 2011年12月04日 05:16:18 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg148838 |
| 2011年12月03日 19:47:48 | pitrou | set | nosy:
+ pitrou messages: + msg148819 |
| 2011年12月03日 19:10:49 | vstinner | create | |