Set argtypes for sprintf from ctypes

Needed on some architectures (see the "Calling variadic functions" in
the ctypes documentation).
This commit is contained in:
Doug Torrance
2026-02-28 13:53:53 -05:00
parent f3e9cf0706
commit d74dff7e48
+1
View File
@@ -864,6 +864,7 @@ except OSError:
def float_print(d, i):
fmt = "%." + str(i) + "a\n"
a = ctypes.create_string_buffer(256)
libc.sprintf.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
libc.sprintf(a, bytes(fmt, 'utf-8'), ctypes.c_double(d))
return a.raw.decode('utf-8').split("\n")[0]