Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-36346: Undeprecate private function _PyUnicode_AsUnicode(). #21336

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(

/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string
contains null characters. */
Py_DEPRECATED(3.3) PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode(
PyObject *unicode /* Unicode object */
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mark ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``,
``PyUnicode_FromUnicode``, ``PyUnicode_AsUnicode``, ``_PyUnicode_AsUnicode``,
``PyUnicode_FromUnicode``, ``PyUnicode_AsUnicode``,
and ``PyUnicode_AsUnicodeAndSize`` as deprecated in C. Remove ``Py_UNICODE_MATCH``
which was deprecated and broken since Python 3.3.
8 changes: 1 addition & 7 deletions Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3310,14 +3310,11 @@ _PyUnicode_WideCharString_Converter(PyObject *obj, void *ptr)
}
if (PyUnicode_Check(obj)) {
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
*p = (wchar_t *)_PyUnicode_AsUnicode(obj);
if (*p == NULL) {
return 0;
}
return 1;
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
*p = PyUnicode_AsWideCharString(obj, NULL);
if (*p == NULL) {
Expand Down Expand Up @@ -3349,14 +3346,11 @@ _PyUnicode_WideCharString_Opt_Converter(PyObject *obj, void *ptr)
}
if (PyUnicode_Check(obj)) {
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
*p = (wchar_t *)_PyUnicode_AsUnicode(obj);
if (*p == NULL) {
return 0;
}
return 1;
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
*p = PyUnicode_AsWideCharString(obj, NULL);
if (*p == NULL) {
Expand Down
3 changes: 0 additions & 3 deletions PC/_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,7 @@ _msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,

if (PyUnicode_Check(data)) {
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
const WCHAR *value = _PyUnicode_AsUnicode(data);
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
WCHAR *value = PyUnicode_AsWideCharString(data, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down
14 changes: 1 addition & 13 deletions PC/clinic/_msi.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 1 addition & 31 deletions PC/clinic/winreg.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3414,10 +3414,7 @@ def parse_arg(self, argname, argnum):
goto exit;
}}}}
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
{paramname} = _PyUnicode_AsUnicode({argname});
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
{paramname} = PyUnicode_AsWideCharString({argname}, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand All @@ -3432,10 +3429,7 @@ def parse_arg(self, argname, argnum):
}}}}
else if (PyUnicode_Check({argname})) {{{{
#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
{paramname} = _PyUnicode_AsUnicode({argname});
_Py_COMP_DIAG_POP
#else /* USE_UNICODE_WCHAR_CACHE */
{paramname} = PyUnicode_AsWideCharString({argname}, NULL);
#endif /* USE_UNICODE_WCHAR_CACHE */
Expand Down