Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r2195:f6fcbe96b598 Date: 2015-06-29 21:55 +0200 http://bitbucket.org/cffi/cffi/changeset/f6fcbe96b598/
Log: ffi.include(ffi) doesn't make sense and hangs right now diff --git a/cffi/api.py b/cffi/api.py --- a/cffi/api.py +++ b/cffi/api.py @@ -428,6 +428,8 @@ raise TypeError("ffi.include() expects an argument that is also of" " type cffi.FFI, not %r" % ( type(ffi_to_include).__name__,)) + if ffi_to_include is self: + raise ValueError("self.include(self)") with ffi_to_include._lock: with self._lock: self._parser.include(ffi_to_include._parser) diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -1770,3 +1770,7 @@ py.test.raises(TypeError, ffi.new, "struct foo_s *") ffi.cdef("struct foo_s { int x; };") ffi.new("struct foo_s *") + + def test_ffi_self_include(self): + ffi = FFI(backend=self.Backend()) + py.test.raises(ValueError, ffi.include, ffi) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit