diff options
author | Victor Stinner <vstinner@python.org> | 2024-12-13 12:53:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-13 12:53:47 (GMT) |
commit | 6ff38fc4e2af8e795dc791be6ea596d2146d4119 (patch) | |
tree | e4a1d93431b8db928fc86d87b248164d39286b47 /Lib/test | |
parent | e62e1ca4553dbcf9d7f89be24bebcbd9213f9ae5 (diff) | |
download | cpython-6ff38fc4e2af8e795dc791be6ea596d2146d4119.zip cpython-6ff38fc4e2af8e795dc791be6ea596d2146d4119.tar.gz cpython-6ff38fc4e2af8e795dc791be6ea596d2146d4119.tar.bz2 |
gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ctypes/test_as_parameter.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_ctypes/test_as_parameter.py b/Lib/test/test_ctypes/test_as_parameter.py index cc62b1a..c5e1840 100644 --- a/Lib/test/test_ctypes/test_as_parameter.py +++ b/Lib/test/test_ctypes/test_as_parameter.py @@ -198,8 +198,16 @@ class BasicWrapTestCase(unittest.TestCase): a = A() a._as_parameter_ = a - with self.assertRaises(RecursionError): - c_int.from_param(a) + for c_type in ( + ctypes.c_wchar_p, + ctypes.c_char_p, + ctypes.c_void_p, + ctypes.c_int, # PyCSimpleType + POINT, # CDataType + ): + with self.subTest(c_type=c_type): + with self.assertRaises(RecursionError): + c_type.from_param(a) class AsParamWrapper: |