mirror of https://github.com/exaloop/codon.git
Update format error checking
Simplifies LLVM IR output when not using format stringspull/157/head
parent
fd43d67f28
commit
0a08303870
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue