summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authortguo-aa <tguo@tguo.lan.appannie.com>2015-09-29 08:30:37 +0800
committertguo-aa <tguo@tguo.lan.appannie.com>2015-09-29 08:34:10 +0800
commitd9db48257b717b3222255f1150d8c41c57f6e0cf (patch)
tree8619ad18a204ce0ce693d00fb76c8bf491be04b0 /python
parente1e1bced08d195c9190ac0d96d64c10abc226f3d (diff)
downloadflatbuffers-d9db48257b717b3222255f1150d8c41c57f6e0cf.tar.gz
flatbuffers-d9db48257b717b3222255f1150d8c41c57f6e0cf.tar.bz2
flatbuffers-d9db48257b717b3222255f1150d8c41c57f6e0cf.zip
Add self.assertNotNested() in CreateString
And also add a test case. If you try to nest CreateString you will get a clear exception.
Diffstat (limited to 'python')
-rw-r--r--python/flatbuffers/builder.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/flatbuffers/builder.py b/python/flatbuffers/builder.py
index 3e7f3ceb..ed509704 100644
--- a/python/flatbuffers/builder.py
+++ b/python/flatbuffers/builder.py
@@ -350,6 +350,8 @@ class Builder(object):
def CreateString(self, s):
"""CreateString writes a null-terminated byte string as a vector."""
+ self.assertNotNested()
+
if isinstance(s, compat.string_types):
x = s.encode()
elif isinstance(s, compat.binary_type):