Update format error checking

Simplifies LLVM IR output when not using format strings
pull/157/head
A. R. Shajii 2023-01-05 11:40:49 -05:00
parent fd43d67f28
commit 0a08303870
1 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ class int:
def __format__(self, format_spec: str) -> str:
err = False
ret = _C.seq_str_int(self, format_spec, __ptr__(err))
if err:
if format_spec and err:
_format_error(ret)
return ret
@ -17,7 +17,7 @@ class Int:
def __format__(self, format_spec: str) -> str:
err = False
ret = _C.seq_str_int(self.__int__(), format_spec, __ptr__(err))
if err:
if format_spec and err:
_format_error(ret)
return ret
@ -26,7 +26,7 @@ class UInt:
def __format__(self, format_spec: str) -> str:
err = False
ret = _C.seq_str_uint(self.__int__(), format_spec, __ptr__(err))
if err:
if format_spec and err:
_format_error(ret)
return ret
@ -35,7 +35,7 @@ class float:
def __format__(self, format_spec: str) -> str:
err = False
ret = _C.seq_str_float(self, format_spec, __ptr__(err))
if err:
if format_spec and err:
_format_error(ret)
return ret if ret != "-nan" else "nan"
@ -44,7 +44,7 @@ class str:
def __format__(self, format_spec: str) -> str:
err = False
ret = _C.seq_str_str(self, format_spec, __ptr__(err))
if err:
if format_spec and err:
_format_error(ret)
return ret
@ -53,6 +53,6 @@ class Ptr:
def __format__(self, format_spec: str) -> str:
err = False
ret = _C.seq_str_ptr(self.as_byte(), format_spec, __ptr__(err))
if err:
if format_spec and err:
_format_error(ret)
return ret