Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit f377936

Browse files
authored
Merge pull request #103 from juanjux/fix/avoid_nulldecref
HasAttribute: Ensure no py_decref is called on a null pointer
2 parents d363170 + fe1ecca commit f377936

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bblfsh/pyuast.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ static PyObject *AttributeValue(const void *node, const char *prop) {
3030

3131
static bool HasAttribute(const void *node, const char *prop) {
3232
PyObject *o = AttributeValue(node, prop);
33-
bool res = o != NULL;
33+
if (o == NULL) {
34+
return false;
35+
}
36+
3437
Py_DECREF(o);
35-
return res;
38+
return true;
3639
}
3740

3841
static const char *String(const void *node, const char *prop) {

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from setuptools import setup, find_packages, Extension
55
from setuptools.command.build_ext import build_ext
66

7-
VERSION = "2.9.12"
7+
VERSION = "2.9.13"
88
LIBUAST_VERSION = "v1.9.1"
99
SDK_VERSION = "v1.8.0"
1010
SDK_MAJOR = SDK_VERSION.split('.')[0]

0 commit comments

Comments
 (0)