Skip to content

Commit 265548a

Browse files
authored
gh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output (GH-115568)
1 parent 04005f5 commit 265548a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/test/test_ctypes/test_callbacks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ def callback(a, b):
148148
print(f"a={a}, b={b}, c={c}")
149149
return c
150150
dll = cdll[_ctypes_test.__file__]
151-
# With no fix for i38748, the next line will raise OSError and cause the test to fail.
152-
self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
153-
151+
with support.captured_stdout() as out:
152+
# With no fix for i38748, the next line will raise OSError and cause the test to fail.
153+
self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
154+
self.assertEqual(out.getvalue(), "a=5, b=10, c=15\n")
154155

155156
if hasattr(ctypes, 'WINFUNCTYPE'):
156157
class StdcallCallbacks(Callbacks):

0 commit comments

Comments
 (0)