Closed Tristramg closed 11 years ago
@CanalTP Good catch, thanks :). Instead of modifying the mutable type_callable_map value on line 37, however, it's probably better to do something like this around line 43 to avoid leaking state between protobuf_to_dict
calls:
if field.type == FieldDescriptor.TYPE_MESSAGE:
type_callable = lambda pb: protobuf_to_dict(pb, type_callable_map=type_callable_map,
use_enum_labels=use_enum_labels)
else:
type_callable = type_callable_map[field.type]
What do you think?
It's fine for me :) :+1:
@CanalTP Merged. I’ve also released this change to the PyPI distribution as 0.0.4 :)
I fixed that by defining the recursion inside the protobuf_to_dict function