Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using enum labels wasn't recursive #2

Merged
merged 1 commit into from
Feb 21, 2013
Merged

Using enum labels wasn't recursive #2

merged 1 commit into from
Feb 21, 2013

Conversation

Tristramg
Copy link

I fixed that by defining the recursion inside the protobuf_to_dict function

@benhodgson
Copy link
Owner

@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?

@Tristramg
Copy link
Author

It's fine for me :) 👍

benhodgson added a commit that referenced this pull request Feb 21, 2013
Using enum labels wasn't recursive
@benhodgson benhodgson merged commit f6a9f66 into benhodgson:master Feb 21, 2013
@benhodgson
Copy link
Owner

@CanalTP Merged. I’ve also released this change to the PyPI distribution as 0.0.4 :)

benhodgson pushed a commit that referenced this pull request Jul 26, 2014
Add support for extensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants