Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/cpp/src/thrift/generate/t_py_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,8 @@ void t_py_generator::generate_py_struct_definition(ostream& out,
t_type* type = (*m_iter)->get_type();
if (type->is_enum()) {
out << indent() << "if name == \"" << (*m_iter)->get_name() << "\":" << '\n'
<< indent() << indent_str() << "super().__setattr__(name, value if hasattr(value, 'value') else "
<< type_name(type) << ".__members__.get(value))" << '\n'
<< indent() << indent_str() << "super().__setattr__(name, value if hasattr(value, 'value') or value is None else "
<< type_name(type) << "(value))" << '\n'
<< indent() << indent_str() << "return" << '\n';
}
}
Expand Down
9 changes: 2 additions & 7 deletions test/py/RunClientServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,8 @@ def main():

generated_dirs = []
for gp_dir in options.genpydirs.split(','):
if gp_dir == 'type_hints':
# Skip type hints tests -> See THRIFT-5885 (it might be related)
print('Skipping \'type_hints\' tests')
continue
if gp_dir == 'enum':
# Skip enum tests -> See THRIFT-5885
print('Skipping \'enum\' tests')
if gp_dir == 'type_hints' and (sys.version_info < (3,7)):
print('Skipping \'type_hints\' test since python 3.7 or later is required')
continue
generated_dirs.append('gen-py-%s' % (gp_dir))

Expand Down