FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-128137: Update PyASCIIObject to handle interned field with the atomic operation by corona10 · Pull Request #128196 · python/cpython · GitHub

Repository navigation

Merged
Prev Previous commit
Next Next commit
Use unsigned short instead
  • Loading branch information
corona10 committed Jan 1, 2025
commit 30c2eb2dd4afb8164eb228795d2e2c0b0b205fce
14 changes: 6 additions & 8 deletions Include/cpython/unicodeobject.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,23 @@ 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 char kind:3;
unsigned short 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 char compact:1;
unsigned short 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 char ascii:1;
unsigned short ascii:1;
/* The object is statically allocated. */
unsigned char statically_allocated:1;
unsigned short statically_allocated:1;
/* Padding to ensure that PyUnicode_DATA() is always aligned to
4 bytes (see issue #19537 on m68k) and we use unsigned char to avoid
4 bytes (see issue #19537 on m68k) and we use unsigned short 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;
unsigned short :10;
} state;
} PyASCIIObject;

Expand Down

Back | FazBrowse Home | New Git URL