diff Tools/gdb/libpython.py @ 72614:93f033c7cfea

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).
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 03 Oct 2011 13:53:37 +0200
parents 69a6c56e8989
children ef1f0434c79c
line wrap: on
line diff
--- a/Tools/gdb/libpython.py	Mon Oct 03 13:28:14 2011 +0200
+++ b/Tools/gdb/libpython.py	Mon Oct 03 13:53:37 2011 +0200
@@ -1132,15 +1132,16 @@
             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