summaryrefslogtreecommitdiff
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-11-11 20:11:15 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2012-11-11 20:11:15 +0100
commit58570e2a9e801c9d6758a79968e54d74f7ce0c45 (patch)
treef66bd116f1e85f3743868c514e6e8de1ce26812f /Python/fileutils.c
parent3b142536f70f81872eac135b55e0572429c5ab46 (diff)
parentaae0fc1b4754dafd00a40c1c48e19e5e19b64343 (diff)
downloadcpython-58570e2a9e801c9d6758a79968e54d74f7ce0c45.tar.gz
Add a test for hashing of unaligned memory buffers (from issue #16427).
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 501cb8c8d6..526751d5ad 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;