This repository was archived by the owner on Mar 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-18
lines changed
Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -154,21 +154,22 @@ static PyObject *PyFilter(PyObject *self, PyObject *args)
154154 return NULL ;
155155
156156 Nodes * nodes = UastFilter (ctx , obj , query );
157- if (nodes ) {
158- int len = NodesSize (nodes );
159- PyObject * list = PyList_New (len );
160-
161- for (int i = 0 ; i < len ; i ++ ) {
162- PyObject * node = (PyObject * )NodeAt (nodes , i );
163- Py_INCREF (node );
164- PyList_SET_ITEM (list , i , node );
165- }
166- NodesFree (nodes );
167- return PySeqIter_New (list );
157+ if (!nodes ) {
158+ char * error = LastError ();
159+ PyErr_SetString (PyExc_RuntimeError , error );
160+ free (error );
161+ return NULL ;
168162 }
163+ int len = NodesSize (nodes );
164+ PyObject * list = PyList_New (len );
169165
166+ for (int i = 0 ; i < len ; i ++ ) {
167+ PyObject * node = (PyObject * )NodeAt (nodes , i );
168+ Py_INCREF (node );
169+ PyList_SET_ITEM (list , i , node );
170+ }
170171 NodesFree (nodes );
171- return PySeqIter_New (PyList_New ( 0 ) );
172+ return PySeqIter_New (list );
172173}
173174
174175static PyMethodDef extension_methods [] = {
Original file line number Diff line number Diff line change @@ -59,10 +59,7 @@ def testUASTFileContents(self):
5959 self ._validate_filter (uast )
6060
6161 def testBrokenFilter (self ):
62- from sys import version_info
63- if version_info [0 :2 ] != (3 , 4 ):
64- # Skip test 3.4: cant capture SystemException from binary modules
65- self .assertRaises (SystemError , filter , 0 , "foo" )
62+ self .assertRaises (RuntimeError , filter , 0 , "foo" )
6663
6764 def testFilterInternalType (self ):
6865 node = Node ()
Original file line number Diff line number Diff line change 55from setuptools import setup , find_packages , Extension
66from setuptools .command .build_ext import build_ext
77
8- LIBUAST_VERSION = "v1.3.0 "
8+ LIBUAST_VERSION = "v1.4.1 "
99SDK_VERSION = "v1.4.2"
1010SDK_MAJOR = SDK_VERSION .split ('.' )[0 ]
1111PYTHON = "python3"
@@ -123,7 +123,7 @@ def main():
123123 'bblfsh.pyuast' ,
124124 libraries = libraries ,
125125 library_dirs = ['/usr/lib' , '/usr/local/lib' ],
126- extra_compile_args = ['-std=c99 ' ],
126+ extra_compile_args = ['-std=gnu99 ' ],
127127 include_dirs = ['bblfsh/libuast/' , '/usr/local/include' , '/usr/local/include/libxml2' ,
128128 '/usr/include' , '/usr/include/libxml2' ], sources = sources )
129129
You can’t perform that action at this time.
0 commit comments