summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBaruch Sterin <baruchs@gmail.com>2013-01-25 03:36:57 -0800
committerBaruch Sterin <baruchs@gmail.com>2013-01-25 03:36:57 -0800
commit43d54351249d57d3f3e8319a941b049dcc5466e8 (patch)
tree4ddc4c2be1a85ae3c21316e8c9ab8186ec285942 /src
parent4aa434ad11355297dffa4b2384b5777e68e8ed8a (diff)
downloadabc-43d54351249d57d3f3e8319a941b049dcc5466e8.tar.gz
abc-43d54351249d57d3f3e8319a941b049dcc5466e8.tar.bz2
abc-43d54351249d57d3f3e8319a941b049dcc5466e8.zip
pyabc: deal better with null counter examples and remove special case handling
Diffstat (limited to 'src')
-rw-r--r--src/python/pyabc.i26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/python/pyabc.i b/src/python/pyabc.i
index 01d14379..1cdc05ff 100644
--- a/src/python/pyabc.i
+++ b/src/python/pyabc.i
@@ -244,8 +244,6 @@ Abc_Cex_t* _cex_get_vec(int i)
return NULL;
}
- if ( pCex == (Abc_Cex_t *)1 )
- return pCex;
return Abc_CexDup( pCex, -1 );
}
@@ -669,6 +667,11 @@ void _set_death_signal();
class _Cex(object):
+ def __new__(cls, pCex):
+ if not pCex:
+ return None
+ return object.__new__(cls)
+
def __init__(self, pCex):
self.pCex = pCex
@@ -689,27 +692,12 @@ class _Cex(object):
def cex_get_vector():
- res = []
-
- for i in xrange(_cex_get_vec_len()):
- cex = _cex_get_vec(i)
-
- if cex is None:
- res.append(None)
- else:
- res.append(_Cex(cex))
-
- return res
+ return [ _Cex(_cex_get_vec(i)) for i in xrange(_cex_get_vec_len()) ]
def cex_get():
- cex = _cex_get()
+ return _Cex( _cex_get() )
- if cex is None:
- return None
-
- return _Cex(cex)
-
def cex_put(cex):
assert cex is not None