Handling overflow test case
if ( base > ( sys . maxsize // 10 ) or ( base == ( sys . maxsize // 10 ) and ( Str [ i ] - '0' ) > 7 ) ) : NEW_LINE INDENT if ( sign == 1 ) : NEW_LINE INDENT return sys . maxsize NEW_LINE DEDENT else : NEW_LINE INDENT return - ( sys . maxsize ) NEW_LINE DEDENT DEDENT base = 10 * base + ( ord ( Str [ i ] ) - ord ( '0' ) ) NEW_LINE i += 1 NEW_LINE return base * sign NEW_LINE