summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-10-30 00:42:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-10-30 00:42:39 (GMT)
commit76df43de30f40b5cc1de9d36a5a083dd8bd8cb27 (patch)
treebe245b62c632a103851fa69d447e8d89e3ac782f /Python/fileutils.c
parenta5e7cd06bb314f338eff3e2ef948ef35bed4487b (diff)
downloadcpython-76df43de30f40b5cc1de9d36a5a083dd8bd8cb27.zip
cpython-76df43de30f40b5cc1de9d36a5a083dd8bd8cb27.tar.gz
cpython-76df43de30f40b5cc1de9d36a5a083dd8bd8cb27.tar.bz2
Issue #16330: Use surrogate-related macros
Patch written by Serhiy Storchaka.
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 501cb8c..526751d 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -85,7 +85,7 @@ _Py_char2wchar(const char* arg, size_t *size)
/* Only use the result if it contains no
surrogate characters. */
for (tmp = res; *tmp != 0 &&
- (*tmp < 0xd800 || *tmp > 0xdfff); tmp++)
+ !Py_UNICODE_IS_SURROGATE(*tmp); tmp++)
;
if (*tmp == 0) {
if (size != NULL)
@@ -131,7 +131,7 @@ _Py_char2wchar(const char* arg, size_t *size)
memset(&mbs, 0, sizeof mbs);
continue;
}
- if (*out >= 0xd800 && *out <= 0xdfff) {
+ if (Py_UNICODE_IS_SURROGATE(*out)) {
/* Surrogate character. Escape the original
byte sequence with surrogateescape. */
argsize -= converted;