示例#1
0
def wcharp2unicode(space, address, maxlength=-1):
    if address == 0:
        return space.w_None
    wcharp_addr = rffi.cast(rffi.CWCHARP, address)
    if maxlength == -1:
        s, lgt = rffi.wcharp2utf8(wcharp_addr)
    else:
        s, lgt = rffi.wcharp2utf8n(wcharp_addr, maxlength)
    return space.newutf8(s, lgt)
示例#2
0
def wcharp2unicode(space, address, maxlength=-1):
    if address == 0:
        return space.w_None
    wcharp_addr = rffi.cast(rffi.CWCHARP, address)
    try:
        if maxlength == -1:
            s, lgt = rffi.wcharp2utf8(wcharp_addr)
        else:
            s, lgt = rffi.wcharp2utf8n(wcharp_addr, maxlength)
    except rutf8.OutOfRange as e:
        raise wrap_unicode_out_of_range_error(space, e)
    return space.newutf8(s, lgt)