Add Clear() for python Builder (#8186)

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
razvanalex
2023-12-18 08:18:11 +02:00
committed by GitHub
parent 66bd3d7400
commit d47cd10d77
3 changed files with 82 additions and 16 deletions

View File

@@ -146,6 +146,20 @@ class Builder(object):
## @endcond
self.finished = False
def Clear(self) -> None:
## @cond FLATBUFFERS_INTERNAL
self.current_vtable = None
self.head = UOffsetTFlags.py_type(len(self.Bytes))
self.minalign = 1
self.objectEnd = None
self.vtables = {}
self.nested = False
self.forceDefaults = False
self.sharedStrings = {}
self.vectorNumElems = None
## @endcond
self.finished = False
def Output(self):
"""Return the portion of the buffer that has been used for writing data.