Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
ab3b721a
Commit
ab3b721a
authored
Jun 07, 2018
by
Tin Tvrtković
Committed by
Wouter van Oortmerssen
Jun 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python: fix default bool value. (#4773)
* Python: fix default bool value. * Small style tweak.
parent
4cfe36ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
idl_gen_python.cpp
src/idl_gen_python.cpp
+7
-2
No files found.
src/idl_gen_python.cpp
View file @
ab3b721a
...
...
@@ -147,8 +147,13 @@ static void GetScalarFieldOfTable(const StructDef &struct_def,
getter
=
"bool("
+
getter
+
")"
;
}
code
+=
Indent
+
Indent
+
Indent
+
"return "
+
getter
+
"
\n
"
;
auto
defaultValue
=
(
is_bool
?
"False"
:
field
.
value
.
constant
);
code
+=
Indent
+
Indent
+
"return "
+
defaultValue
+
"
\n\n
"
;
std
::
string
default_value
;
if
(
is_bool
)
{
default_value
=
field
.
value
.
constant
==
"0"
?
"False"
:
"True"
;
}
else
{
default_value
=
field
.
value
.
constant
;
}
code
+=
Indent
+
Indent
+
"return "
+
default_value
+
"
\n\n
"
;
}
// Get a struct by initializing an existing struct.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment