summaryrefslogtreecommitdiff
path: root/astroid/builder.py
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2014-11-18 18:16:31 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2014-11-18 18:16:31 +0200
commitafa7bc09af559327e6c195c9c1f2c940360fbad5 (patch)
tree101497232fbf275fbf9d613f18577285b8602043 /astroid/builder.py
parent04a1163ee113af18fb61188eb0865594e8594837 (diff)
downloadastroid-afa7bc09af559327e6c195c9c1f2c940360fbad5.tar.gz
Fail gracefully when the string contains null bytes.
Diffstat (limited to 'astroid/builder.py')
-rw-r--r--astroid/builder.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/astroid/builder.py b/astroid/builder.py
index 692261e..fdfdace 100644
--- a/astroid/builder.py
+++ b/astroid/builder.py
@@ -160,7 +160,10 @@ class AstroidBuilder(InspectBuilder):
def _data_build(self, data, modname, path):
"""build tree node from data and add some informations"""
# this method could be wrapped with a pickle/cache function
- node = parse(data + '\n')
+ try:
+ node = parse(data + '\n')
+ except TypeError as exc:
+ raise AstroidBuildingException(exc)
if path is not None:
node_file = abspath(path)
else: