]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output...
authorKirill Podoprigora <kirill.bast9@mail.ru>
Sat, 17 Feb 2024 13:17:55 +0000 (16:17 +0300)
committerGitHub <noreply@github.com>
Sat, 17 Feb 2024 13:17:55 +0000 (15:17 +0200)
Lib/test/test_ctypes/test_callbacks.py

index 19f4158c0ac8461514a9269643cfb4f987b43ff8..64f92ffdca6a3f880c307e0fe1b5216f1b8b95ed 100644 (file)
@@ -148,9 +148,10 @@ class Callbacks(unittest.TestCase):
             print(f"a={a}, b={b}, c={c}")
             return c
         dll = cdll[_ctypes_test.__file__]
-        # With no fix for i38748, the next line will raise OSError and cause the test to fail.
-        self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
-
+        with support.captured_stdout() as out:
+            # With no fix for i38748, the next line will raise OSError and cause the test to fail.
+            self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
+            self.assertEqual(out.getvalue(), "a=5, b=10, c=15\n")
 
 if hasattr(ctypes, 'WINFUNCTYPE'):
     class StdcallCallbacks(Callbacks):