diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-03-26 22:56:28 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-03-26 22:56:28 (GMT) |
commit | 8d6c62dd892de77295e9db7b1c56fec041726afb (patch) | |
tree | 95c6866844be8485c210b2f456747e759e551d28 /Lib/ctypes | |
parent | b8a5769a6d35931f4dc5395686f590b5dcb58cdd (diff) | |
download | cpython-8d6c62dd892de77295e9db7b1c56fec041726afb.zip cpython-8d6c62dd892de77295e9db7b1c56fec041726afb.tar.gz cpython-8d6c62dd892de77295e9db7b1c56fec041726afb.tar.bz2 |
check possible recursive _as_parameter_ to prevent segfault (closes #1838)
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/test/test_as_parameter.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_as_parameter.py b/Lib/ctypes/test/test_as_parameter.py index 835398f..475d595 100644 --- a/Lib/ctypes/test/test_as_parameter.py +++ b/Lib/ctypes/test/test_as_parameter.py @@ -187,6 +187,18 @@ class BasicWrapTestCase(unittest.TestCase): self.assertEqual((s8i.a, s8i.b, s8i.c, s8i.d, s8i.e, s8i.f, s8i.g, s8i.h), (9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9)) + def test_recursive_as_param(self): + from ctypes import c_int + + class A(object): + pass + + a = A() + a._as_parameter_ = a + with self.assertRaises(RuntimeError): + c_int.from_param(a) + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class AsParamWrapper(object): |