mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Implement optional scalars for Python (#7318)
* Implement optional scalars for Python * Use == for integer comparison, remove empty line * Fix optional type hint Co-authored-by: Caleb Zulawski <caleb.zulawski@caci.com>
This commit is contained in:
@@ -578,9 +578,11 @@ class Builder(object):
|
||||
self.Place(off, flags)
|
||||
|
||||
def PrependSlot(self, flags, o, x, d):
|
||||
N.enforce_number(x, flags)
|
||||
N.enforce_number(d, flags)
|
||||
if x != d or self.forceDefaults:
|
||||
if x is not None:
|
||||
N.enforce_number(x, flags)
|
||||
if d is not None:
|
||||
N.enforce_number(d, flags)
|
||||
if x != d or (self.forceDefaults and d is not None):
|
||||
self.Prepend(flags, x)
|
||||
self.Slot(o)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user