Commit 346e863a by Victor M. Alvarez

Fix regression in "includes" argument in yara.compile. With includes=True…

Fix regression in "includes" argument in yara.compile. With includes=True includes were being disabled instead of enabled.

Closes #78.
parent 22064e27
...@@ -755,7 +755,7 @@ class TestYara(unittest.TestCase): ...@@ -755,7 +755,7 @@ class TestYara(unittest.TestCase):
r = yara.compile(p2) r = yara.compile(p2)
self.assertTrue(len(r.match(data='dummy')) == 2) self.assertTrue(len(r.match(data='dummy')) == 2)
self.assertRaises(yara.SyntaxError, yara.compile, source='include "test"', includes=False) self.assertRaises(yara.SyntaxError, yara.compile, source='include "test2"', includes=False)
def testExternals(self): def testExternals(self):
......
...@@ -1894,7 +1894,7 @@ static PyObject* yara_compile( ...@@ -1894,7 +1894,7 @@ static PyObject* yara_compile(
if (PyBool_Check(includes)) if (PyBool_Check(includes))
{ {
// PyObject_IsTrue can return -1 in case of error // PyObject_IsTrue can return -1 in case of error
if (PyObject_IsTrue(includes) == 1) if (PyObject_IsTrue(includes) == 0)
yr_compiler_set_include_callback(compiler, NULL, NULL, NULL); yr_compiler_set_include_callback(compiler, NULL, NULL, NULL);
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment