• Kevin Modzelewski's avatar
    Support buggy callers of PyString_GET_SIZE · 5592f785
    Kevin Modzelewski authored
    In CPython, PyString_GET_SIZE and PyUnicode_GET_SIZE happen to have
    the same implementation, so it is ok for callers to be wrong about
    which one they call.
    
    For us, previous to this commit, PyString_GET_SIZE would call PyString_Size,
    which has different behavior than PyString_GET_SIZE for non-strings.
    For unicode objects it means that we would return the size of the encoded
    representation of the string rather than the number of unicode characters.
    It also means that PyString_GET_SIZE can fail for us and return -1,
    which it never can for CPython, so callers get away with not
    checking the return value.
    5592f785
str.cpp 90.5 KB