From 91048279ba42c304df5ae30370c64efd8a4b4bdf Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Wed, 21 May 2003 18:08:26 +0000 Subject: [PATCH] Experimental contract work. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4807 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/pyrun.swg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/python/pyrun.swg b/Lib/python/pyrun.swg index 3e9aafdc2..6ce5f656e 100644 --- a/Lib/python/pyrun.swg +++ b/Lib/python/pyrun.swg @@ -405,6 +405,12 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { #endif +/* Contract support */ + +#define SWIG_preassert(x) if (!(x)) { PyErr_SetString(PyExc_RuntimeError, "preassertion failure: " #x); goto fail; } else +#define SWIG_postassert(x) if (!(x)) { PyErr_SetString(PyExc_RuntimeError, "postassertion failure: " #x); goto fail; } else +#define SWIG_invarassert(x) if (!(x)) { PyErr_SetString(PyExc_RuntimeError, "invariant failure: " #x); goto fail; } else + #ifdef __cplusplus } #endif