summaryrefslogtreecommitdiff
path: root/Modules/unicodedata.c
diff options
context:
space:
mode:
authorMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
committerMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
commitda79bcf8ac7ae72218ab023e1ed54390bc1a3a27 (patch)
tree74845e2dbd9521d9748b9c32f1922f4123083bf3 /Modules/unicodedata.c
parente3c7e835bdfc97750eb9b7fc0ad2493108c2d438 (diff)
parent1fe806ac56f8b83694d24ab604eb695d00bc8497 (diff)
downloadcpython-da79bcf8ac7ae72218ab023e1ed54390bc1a3a27.tar.gz
Issue #29371: merge with 3.5
Diffstat (limited to 'Modules/unicodedata.c')
-rw-r--r--Modules/unicodedata.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 1f9ba78654..9e71e018e2 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -45,6 +45,7 @@ typedef struct change_record {
const unsigned char category_changed;
const unsigned char decimal_changed;
const unsigned char mirrored_changed;
+ const unsigned char east_asian_width_changed;
const double numeric_changed;
} change_record;
@@ -375,6 +376,8 @@ unicodedata_UCD_east_asian_width_impl(PyObject *self, int chr)
const change_record *old = get_old_record(self, c);
if (old->category_changed == 0)
index = 0; /* unassigned */
+ else if (old->east_asian_width_changed != 0xFF)
+ index = old->east_asian_width_changed;
}
return PyUnicode_FromString(_PyUnicode_EastAsianWidthNames[index]);
}
@@ -884,7 +887,7 @@ _gethash(const char *s, int len, int scale)
return h;
}
-static char *hangul_syllables[][3] = {
+static const char * const hangul_syllables[][3] = {
{ "G", "A", "" },
{ "GG", "AE", "G" },
{ "N", "YA", "GG" },
@@ -1057,7 +1060,7 @@ find_syllable(const char *str, int *len, int *pos, int count, int column)
int i, len1;
*len = -1;
for (i = 0; i < count; i++) {
- char *s = hangul_syllables[i][column];
+ const char *s = hangul_syllables[i][column];
len1 = Py_SAFE_DOWNCAST(strlen(s), size_t, int);
if (len1 <= *len)
continue;