diff options
author | Armin Rigo <arigo@tunes.org> | 2019-10-21 11:24:17 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2019-10-21 11:24:17 +0200 |
commit | 6ea8b8f9c0bbe87ba21b51c1bb540ea0e69a4e60 (patch) | |
tree | 15f48e8c522fc5a39edc065e7eed73835d98aa4e /testing | |
parent | e97940538548db03bdb341a3072e3bf505317d2d (diff) | |
download | cffi-6ea8b8f9c0bbe87ba21b51c1bb540ea0e69a4e60.tar.gz |
Issue #429
There are corner cases in which we can see a recursion on the same types.
Instead of fighting them all, change the logic to complain if we recurse
more than 1000 times.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/cffi1/test_re_python.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/testing/cffi1/test_re_python.py b/testing/cffi1/test_re_python.py index 2a70790..8b998d7 100644 --- a/testing/cffi1/test_re_python.py +++ b/testing/cffi1/test_re_python.py @@ -75,6 +75,7 @@ def setup_module(mod): struct with_union { union { int a; char b; }; }; union with_struct { struct { int a; char b; }; }; struct NVGcolor { union { float rgba[4]; struct { float r,g,b,a; }; }; }; + typedef struct selfref { struct selfref *next; } *selfref_ptr_t; """) ffi.set_source('re_python_pysrc', None) ffi.emit_python_code(str(tmpdir.join('re_python_pysrc.py'))) @@ -254,3 +255,8 @@ def test_anonymous_union_inside_struct(): assert ffi.offsetof("struct NVGcolor", "g") == FLOAT assert ffi.offsetof("struct NVGcolor", "b") == FLOAT * 2 assert ffi.offsetof("struct NVGcolor", "a") == FLOAT * 3 + +def test_selfref(): + # based on issue #429 + from re_python_pysrc import ffi + ffi.new("selfref_ptr_t") |