Skip to content

bpo-41123: Remove Py_UNICODE_COPY() and Py_UNICODE_FILL() #28887

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

Merged
merged 1 commit into from
Oct 11, 2021
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
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,8 @@ Removed
* ``Py_SET_ERRNO_ON_MATH_ERROR()``

(Contributed by Victor Stinner in :issue:`45412`.)

* Remove ``Py_UNICODE_COPY()`` and ``Py_UNICODE_FILL()`` macros, deprecated
since Python 3.3. Use ``PyUnicode_CopyCharacters()`` or ``memcpy()``
(``wchar_t*`` string), and ``PyUnicode_Fill()`` functions instead.
(Contributed by Victor Stinner in :issue:`41123`.)
13 changes: 0 additions & 13 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@
Py_UNICODE_ISDIGIT(ch) || \
Py_UNICODE_ISNUMERIC(ch))

Py_DEPRECATED(3.3) static inline void
Py_UNICODE_COPY(Py_UNICODE *target, const Py_UNICODE *source, Py_ssize_t length) {
memcpy(target, source, (size_t)(length) * sizeof(Py_UNICODE));
}

Py_DEPRECATED(3.3) static inline void
Py_UNICODE_FILL(Py_UNICODE *target, Py_UNICODE value, Py_ssize_t length) {
Py_ssize_t i;
for (i = 0; i < length; i++) {
target[i] = value;
}
}

/* macros to work with surrogates */
#define Py_UNICODE_IS_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDFFF)
#define Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= (ch) && (ch) <= 0xDBFF)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Remove ``Py_UNICODE_COPY()`` and ``Py_UNICODE_FILL()`` macros, deprecated
since Python 3.3. Use ``PyUnicode_CopyCharacters()`` or ``memcpy()``
(``wchar_t*`` string), and ``PyUnicode_Fill()`` functions instead. Patch by
Victor Stinner.