-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-105156: Cleanup usage of old Py_UNICODE type #105158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
* refcounts.dat: * Remove Py_UNICODE functions * Replace Py_UNICODE argument type with wchar_t * _PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(), _PyUnicode_ToTitlecase() are no longer deprecate in comment. It's no longer needed since they now use Py_UCS4 type, rather than the deprecated Py_UNICODE type. * gdb: Remove unused char_width() method.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1390,10 +1390,6 @@ def _unichr_is_printable(char): | |||||
class PyUnicodeObjectPtr(PyObjectPtr): | ||||||
_typename = 'PyUnicodeObject' | ||||||
|
||||||
def char_width(self): | ||||||
_type_Py_UNICODE = gdb.lookup_type('Py_UNICODE') | ||||||
return _type_Py_UNICODE.sizeof | ||||||
|
||||||
def proxyval(self, visited): | ||||||
compact = self.field('_base') | ||||||
ascii = compact['_base'] | ||||||
|
@@ -1414,13 +1410,13 @@ def proxyval(self, visited): | |||||
elif repr_kind == 4: | ||||||
field_str = field_str.cast(_type_unsigned_int_ptr()) | ||||||
|
||||||
# Gather a list of ints from the Py_UNICODE array; these are either | ||||||
# Gather a list of ints from the character array; these are either | ||||||
# UCS-1, UCS-2 or UCS-4 code points: | ||||||
Py_UNICODEs = [int(field_str[i]) for i in safe_range(field_length)] | ||||||
characters = [int(field_str[i]) for i in safe_range(field_length)] | ||||||
|
||||||
# Convert the int code points to unicode characters, and generate a | ||||||
# local unicode instance. | ||||||
result = u''.join(map(chr, Py_UNICODEs)) | ||||||
result = u''.join(map(chr, characters)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing supporting for Python 2 require way more changes. I prefer to restrict changes to just Py_UNICODE here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, I removed Python 2 support from libpython.py already. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I didn't know. Well, feel free to remove that |
||||||
return result | ||||||
|
||||||
def write_repr(self, out, visited): | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.