Skip to content

Commit 53147e7

Browse files
committed
Address code review
1 parent f5c4d96 commit 53147e7

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Include/cpython/unicodeobject.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,25 @@ typedef struct {
132132
* all characters are in the range U+0000-U+10FFFF
133133
* at least one character is in the range U+10000-U+10FFFF
134134
*/
135-
unsigned int kind:3;
135+
unsigned char kind:3;
136136
/* Compact is with respect to the allocation scheme. Compact unicode
137137
objects only require one memory block while non-compact objects use
138138
one block for the PyUnicodeObject struct and another for its data
139139
buffer. */
140-
unsigned int compact:1;
140+
unsigned char compact:1;
141141
/* The string only contains characters in the range U+0000-U+007F (ASCII)
142142
and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is
143143
set, use the PyASCIIObject structure. */
144-
unsigned int ascii:1;
144+
unsigned char ascii:1;
145145
/* The object is statically allocated. */
146-
unsigned int statically_allocated:1;
146+
unsigned char statically_allocated:1;
147147
/* Padding to ensure that PyUnicode_DATA() is always aligned to
148-
4 bytes (see issue #19537 on m68k). */
149-
unsigned int :18;
148+
4 bytes (see issue #19537 on m68k) and we use unsigned char to avoid
149+
the extra four bytes on 32-bit Windows. This is restricted features
150+
for specific compilers including GCC, MSVC, Clang and IBM's XL compiler. */
151+
unsigned char :2;
152+
unsigned char :8;
153+
unsigned char :8;
150154
} state;
151155
} PyASCIIObject;
152156

Lib/test/test_str.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,8 +2450,6 @@ def test_expandtabs_optimization(self):
24502450

24512451
def test_raiseMemError(self):
24522452
asciifields = "nnb"
2453-
if not support.is_wasi:
2454-
asciifields = asciifields + "7x"
24552453
compactfields = asciifields + "nP"
24562454
ascii_struct_size = support.calcobjsize(asciifields)
24572455
compact_struct_size = support.calcobjsize(compactfields)

Lib/test/test_sys.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,8 +1763,6 @@ class newstyleclass(object): pass
17631763
'\U00010000'*30, '\U0010ffff'*100]
17641764
# also update field definitions in test_unicode.test_raiseMemError
17651765
asciifields = "nnb"
1766-
if not support.is_wasi:
1767-
asciifields = asciifields + "7x"
17681766
compactfields = asciifields + "nP"
17691767
unicodefields = compactfields + "P"
17701768
for s in samples:

0 commit comments

Comments
 (0)