From d74dff7e48432bb76240fc1f970e127adbe2a4e2 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 28 Feb 2026 13:53:53 -0500 Subject: [PATCH] Set argtypes for sprintf from ctypes Needed on some architectures (see the "Calling variadic functions" in the ctypes documentation). --- mpmath/tests/test_format.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mpmath/tests/test_format.py b/mpmath/tests/test_format.py index 00ac61f2..896c003c 100644 --- a/mpmath/tests/test_format.py +++ b/mpmath/tests/test_format.py @@ -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]