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.

classification
Title: Use surrogate-related macros
Type: enhancement Stage: resolved
Components: Interpreter Core, Unicode Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, pitrou, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2012-10-26 15:42 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
use_surrogate_macros.patch serhiy.storchaka, 2012-10-26 15:42 review
Messages (7)
msg173855 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-10-26 15:42
A set of macros to work with surrogates was introduced in 3.3: Py_UNICODE_IS_SURROGATE, Py_UNICODE_IS_HIGH_SURROGATE, Py_UNICODE_IS_LOW_SURROGATE, Py_UNICODE_JOIN_SURROGATES, Py_UNICODE_HIGH_SURROGATE, and Py_UNICODE_LOW_SURROGATE.  Using this macros makes a code more readable, protect from errors, and allows use the one most effective implementation.  But not all surrogate-related code uses this macros.  I suppose this is done inadvertently, somewhere the macro and naked code used in neighboring lines.

The proposed patch replaces a naked surrogate code to macros in all places except expat (which is a foreign code).
msg174167 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-30 00:43
New changeset 13dd8199c112 by Victor Stinner in branch 'default':
Issue #16330: Use surrogate-related macros
http://hg.python.org/cpython/rev/13dd8199c112
msg174168 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-10-30 00:44
"But not all surrogate-related code uses this macros.  I suppose this is done inadvertently, somewhere the macro and naked code used in neighboring lines."

Yeah, I forgot to use the new macros in these files. Thanks for your patch, I applied it. I also fixed *IS*() macros to add parenthesis around the argument.
msg174176 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-30 01:30
New changeset 812f5c379188 by Victor Stinner in branch 'default':
Issue #16330: Fix compilation on Windows
http://hg.python.org/cpython/rev/812f5c379188
msg174187 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-10-30 09:23
Thanks.

> Issue #16330: Fix compilation on Windows

Oh, how could I miss this?
msg174200 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-10-30 10:56
> Oh, how could I miss this?

The code does compile with error on Linux with GCC. I don't understand how.
msg174202 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-10-30 11:30
It was a rhetorical question.  This code compiled only if Py_UNICODE_SIZE == 2.  But I should be more careful.
History
Date User Action Args
2022-04-11 14:57:37adminsetgithub: 60534
2012-10-30 11:30:54serhiy.storchakasetmessages: + msg174202
2012-10-30 10:56:40vstinnersetmessages: + msg174200
2012-10-30 09:23:12serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg174187

stage: patch review -> resolved
2012-10-30 01:30:32python-devsetmessages: + msg174176
2012-10-30 00:44:13vstinnersetmessages: + msg174168
2012-10-30 00:43:27python-devsetnosy: + python-dev
messages: + msg174167
2012-10-26 15:42:56serhiy.storchakacreate