diff options
author | tguo-aa <tguo@tguo.lan.appannie.com> | 2015-09-29 08:30:37 +0800 |
---|---|---|
committer | tguo-aa <tguo@tguo.lan.appannie.com> | 2015-09-29 08:34:10 +0800 |
commit | d9db48257b717b3222255f1150d8c41c57f6e0cf (patch) | |
tree | 8619ad18a204ce0ce693d00fb76c8bf491be04b0 /python | |
parent | e1e1bced08d195c9190ac0d96d64c10abc226f3d (diff) | |
download | flatbuffers-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.py | 2 |
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): |