Skip to content

Commit

Permalink
Address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Jan 1, 2025
1 parent f5c4d96 commit 53147e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 10 additions & 6 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,25 @@ typedef struct {
* all characters are in the range U+0000-U+10FFFF
* at least one character is in the range U+10000-U+10FFFF
*/
unsigned int kind:3;
unsigned char kind:3;
/* Compact is with respect to the allocation scheme. Compact unicode
objects only require one memory block while non-compact objects use
one block for the PyUnicodeObject struct and another for its data
buffer. */
unsigned int compact:1;
unsigned char compact:1;
/* The string only contains characters in the range U+0000-U+007F (ASCII)
and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is
set, use the PyASCIIObject structure. */
unsigned int ascii:1;
unsigned char ascii:1;
/* The object is statically allocated. */
unsigned int statically_allocated:1;
unsigned char statically_allocated:1;
/* Padding to ensure that PyUnicode_DATA() is always aligned to
4 bytes (see issue #19537 on m68k). */
unsigned int :18;
4 bytes (see issue #19537 on m68k) and we use unsigned char to avoid
the extra four bytes on 32-bit Windows. This is restricted features
for specific compilers including GCC, MSVC, Clang and IBM's XL compiler. */
unsigned char :2;
unsigned char :8;
unsigned char :8;
} state;
} PyASCIIObject;

Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -2450,8 +2450,6 @@ def test_expandtabs_optimization(self):

def test_raiseMemError(self):
asciifields = "nnb"
if not support.is_wasi:
asciifields = asciifields + "7x"
compactfields = asciifields + "nP"
ascii_struct_size = support.calcobjsize(asciifields)
compact_struct_size = support.calcobjsize(compactfields)
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1763,8 +1763,6 @@ class newstyleclass(object): pass
'\U00010000'*30, '\U0010ffff'*100]
# also update field definitions in test_unicode.test_raiseMemError
asciifields = "nnb"
if not support.is_wasi:
asciifields = asciifields + "7x"
compactfields = asciifields + "nP"
unicodefields = compactfields + "P"
for s in samples:
Expand Down

0 comments on commit 53147e7

Please sign in to comment.