mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
PyUnicode_Ready() now sets ascii=1 if maxchar < 128
ascii=1 is no more reserved to PyASCIIObject. Use PyUnicode_IS_COMPACT_ASCII(obj) to check if obj is a PyASCIIObject (as before).
This commit is contained in:
parent
1b4f9ceca7
commit
a3b334da6d
3 changed files with 42 additions and 33 deletions
|
@ -1132,15 +1132,16 @@ class PyUnicodeObjectPtr(PyObjectPtr):
|
|||
compact = self.field('_base')
|
||||
ascii = compact['_base']
|
||||
state = ascii['state']
|
||||
is_compact_ascii = (int(state['ascii']) and int(state['compact']))
|
||||
field_length = long(ascii['length'])
|
||||
if not int(state['ready']):
|
||||
# string is not ready
|
||||
may_have_surrogates = True
|
||||
field_str = ascii['wstr']
|
||||
if not int(state['ascii']):
|
||||
if not is_compact_ascii:
|
||||
field_length = compact('wstr_length')
|
||||
else:
|
||||
if int(state['ascii']):
|
||||
if is_compact_ascii:
|
||||
field_str = ascii.address + 1
|
||||
elif int(state['compact']):
|
||||
field_str = compact.address + 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue