Skip to content

Recursive message support #74

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

Closed
firdaus opened this issue May 27, 2020 · 3 comments · Fixed by #130
Closed

Recursive message support #74

firdaus opened this issue May 27, 2020 · 3 comments · Fixed by #130
Labels
bug Something isn't working high priority medium Medium effort issue, can fit in a single PR
Milestone

Comments

@firdaus
Copy link

firdaus commented May 27, 2020

I am working on implementing a GRPC client which has a message such as this:

message Failure {
    ...
    Failure cause = 4;
    ...
}

Unfortunately it seems like betterproto attempts to build an object graph for this and this results in the following error:

RecursionError: maximum recursion depth exceeded while calling a Python object

I was wondering whether the project is planning on supporting this.

My plan in the short run is to just fork betterproto for my project and not set a default value for sub-messages in _get_field_default.

If the maintainers have a better approach to fixing this I would gladly offer my time in submitting a PR for it.

@boukeversteegh boukeversteegh added the bug Something isn't working label May 29, 2020
@boukeversteegh
Copy link
Collaborator

Thank you @firdaus for your report!

What would help for us, if you could make a PR to add a failing test-case for the scenario.

Please have a look at betterproto/tests/README.md

In short, create a new folder in inputs with the proto and json file, and add them to the xfail-list in tests/inputs/config.py

I personally think this should be supported. We have a lot of major bugs to fix still, so can't promise how quickly this will get implemented as we are a small number of voluntary contributors.

Let us know if you'd like any help~ we are on slack at https://betterproto.slack.com/

@boukeversteegh boukeversteegh added this to the Better Fields milestone May 29, 2020
@jameslan
Copy link
Contributor

jameslan commented Jun 7, 2020

I think this is duplicate with #13

@boukeversteegh
Copy link
Collaborator

I think this is duplicate with #13

Looks like that indeed! The other issue shows an indirect recursion, whereas this one is an immediate recursion.

Solving one will solve both, most likely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority medium Medium effort issue, can fit in a single PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants