Skip to content

Commit 6fec905

Browse files
authored
bpo-36642: make unicodedata const (GH-12855)
1 parent 926b0cb commit 6fec905

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

Modules/unicodedata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ _getucname(PyObject *self, Py_UCS4 code, char* buffer, int buflen,
10291029
int offset;
10301030
int i;
10311031
int word;
1032-
unsigned char* w;
1032+
const unsigned char* w;
10331033

10341034
if (code >= 0x110000)
10351035
return 0;

Modules/unicodedata_db.h

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/unicodename_db.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define NAME_MAXLEN 256
44

55
/* lexicon */
6-
static unsigned char lexicon[] = {
6+
static const unsigned char lexicon[] = {
77
76, 69, 84, 84, 69, 210, 83, 73, 71, 206, 87, 73, 84, 200, 83, 77, 65,
88
76, 204, 83, 89, 76, 76, 65, 66, 76, 197, 67, 65, 80, 73, 84, 65, 204,
99
72, 73, 69, 82, 79, 71, 76, 89, 80, 200, 76, 65, 84, 73, 206, 65, 82, 65,
@@ -6442,7 +6442,7 @@ static unsigned char lexicon[] = {
64426442
45, 68, 90, 85, 196, 45, 67, 72, 65, 210, 45, 67, 72, 65, 76, 128,
64436443
};
64446444

6445-
static unsigned int lexicon_offset[] = {
6445+
static const unsigned int lexicon_offset[] = {
64466446
0, 0, 6, 10, 14, 19, 27, 34, 44, 49, 55, 64, 66, 69, 81, 89, 102, 108,
64476447
113, 118, 124, 129, 137, 146, 157, 162, 167, 170, 174, 183, 189, 195,
64486448
201, 206, 214, 221, 229, 171, 232, 241, 242, 250, 256, 261, 266, 273,
@@ -8012,7 +8012,7 @@ static unsigned int lexicon_offset[] = {
80128012
/* code->name phrasebook */
80138013
#define phrasebook_shift 7
80148014
#define phrasebook_short 194
8015-
static unsigned char phrasebook[] = {
8015+
static const unsigned char phrasebook[] = {
80168016
0, 205, 148, 236, 89, 78, 211, 61, 78, 31, 55, 239, 9, 55, 213, 44, 55,
80178017
251, 110, 251, 29, 50, 213, 139, 53, 213, 139, 250, 178, 98, 55, 244,
80188018
158, 231, 5, 234, 216, 204, 226, 205, 177, 17, 195, 79, 17, 100, 17, 102,
@@ -19073,7 +19073,7 @@ static unsigned char phrasebook[] = {
1907319073
73, 241, 124, 152, 154,
1907419074
};
1907519075

19076-
static unsigned short phrasebook_offset1[] = {
19076+
static const unsigned short phrasebook_offset1[] = {
1907719077
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1907819078
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
1907919079
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
@@ -19696,7 +19696,7 @@ static unsigned short phrasebook_offset1[] = {
1969619696
104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
1969719697
};
1969819698

19699-
static unsigned int phrasebook_offset2[] = {
19699+
static const unsigned int phrasebook_offset2[] = {
1970019700
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1970119701
0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 6, 9, 11, 14, 17, 19, 21, 24, 27, 29, 31,
1970219702
33, 35, 39, 41, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 69, 72,
@@ -23496,7 +23496,7 @@ static unsigned int phrasebook_offset2[] = {
2349623496
};
2349723497

2349823498
/* name->code dictionary */
23499-
static unsigned int code_hash[] = {
23499+
static const unsigned int code_hash[] = {
2350023500
74224, 4851, 0, 0, 0, 0, 7929, 0, 0, 0, 0, 127931, 0, 42833, 983091,
2350123501
12064, 0, 129548, 194597, 69850, 65842, 0, 0, 0, 78159, 68476, 72392,
2350223502
1373, 0, 0, 5816, 0, 0, 4231, 0, 0, 4233, 4234, 4232, 68885, 70351, 0,

Objects/unicodetype_db.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@ const Py_UCS4 _PyUnicode_ExtendedCase[] = {
17501750

17511751
/* type indexes */
17521752
#define SHIFT 7
1753-
static unsigned short index1[] = {
1753+
static const unsigned short index1[] = {
17541754
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
17551755
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37,
17561756
38, 39, 34, 34, 34, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
@@ -2359,7 +2359,7 @@ static unsigned short index1[] = {
23592359
126, 126, 126, 126, 126, 126, 126, 269,
23602360
};
23612361

2362-
static unsigned short index2[] = {
2362+
static const unsigned short index2[] = {
23632363
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
23642364
1, 1, 1, 1, 3, 3, 3, 2, 4, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 6, 5,
23652365
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 6, 5, 5, 5, 5, 5, 5, 17, 17, 17, 17,

Tools/unicode/makeunicodedata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ def dump(self, file, trace=0):
12491249
size = getsize(self.data)
12501250
if trace:
12511251
print(self.name+":", size*len(self.data), "bytes", file=sys.stderr)
1252-
file.write("static ")
1252+
file.write("static const ")
12531253
if size == 1:
12541254
file.write("unsigned char")
12551255
elif size == 2:

0 commit comments

Comments
 (0)