Skip to content

Commit 6e89292

Browse files
[3.12] gh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output (GH-115568) (GH-115609)
(cherry picked from commit 265548a) Co-authored-by: Kirill Podoprigora <[email protected]>
1 parent c726d1c commit 6e89292

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/test/test_ctypes/test_callbacks.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ def callback(a, b):
151151
print(f"a={a}, b={b}, c={c}")
152152
return c
153153
dll = cdll[_ctypes_test.__file__]
154-
# With no fix for i38748, the next line will raise OSError and cause the test to fail.
155-
self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
156-
154+
with support.captured_stdout() as out:
155+
# With no fix for i38748, the next line will raise OSError and cause the test to fail.
156+
self.assertEqual(dll._test_i38748_runCallback(callback, 5, 10), 15)
157+
self.assertEqual(out.getvalue(), "a=5, b=10, c=15\n")
157158

158159
@need_symbol('WINFUNCTYPE')
159160
class StdcallCallbacks(Callbacks):

0 commit comments

Comments
 (0)