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

In name of lazy "gnossen" I report bug "Incompability bug removed including_default_value_fields=False keyword without explanation (works in 1.62 but not in 1.64-1.68)" #19450

Open
ChameleonRed opened this issue Nov 29, 2024 · 2 comments
Assignees
Labels

Comments

@ChameleonRed
Copy link

https://github.com/gnossen thinks that is should reported here so I report in his name.
I have not Idea why I should report this bug here but you can explain me.

Tell me if it should be solved here?

grpc/grpc#37184

grpc/grpc#37184 (comment)

What version of protobuf and what language are you using?

I am using gRPC 1.64.

What operating system (Linux, Windows, ...) and version?

grpc/grpc#37184

What runtime / compiler are you using (e.g., python version or gcc version)

grpc/grpc#37184

What did you do?

grpc/grpc#37184

What did you see instead?

grpc/grpc#37184

Anything else we should know about your project / environment

I am using gRPC 1.64 which become incompatible.

@ChameleonRed ChameleonRed added the untriaged auto added to all issues by default when created. label Nov 29, 2024
@ChameleonRed
Copy link
Author

ChameleonRed commented Nov 29, 2024

I get such answer - I can not read you answer since it is protected access - it is not answer?

https://engdoc.corp.google.com/eng/doc/devguide/proto/news/v26.md#JSON - how to read protected content?

Can you fix bug to allow use grpc 1.64+ without problems?

#17705

@shaod2 shaod2 added python and removed untriaged auto added to all issues by default when created. labels Dec 9, 2024
@zhangskz
Copy link
Member

zhangskz commented Dec 9, 2024

Copying over the error from the issue reported to gRPC -- for future issues, it would be helpful to include more info directly in the github issue.

def MessageToJson(
    message,
    preserving_proto_field_name=False,
    indent=2,
    sort_keys=False,
    use_integers_for_enums=False,
    descriptor_pool=None,
    float_precision=None,
    ensure_ascii=True,
    always_print_fields_with_no_presence=False,
):

    reply_json = json_format.MessageToJson(reply, including_default_value_fields=True, preserving_proto_field_name=True)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: MessageToJson() got an unexpected keyword argument 'including_default_value_fields'

including_default_value_fields was removed as part of the 5.26.x python breaking change. See
https://engdoc.corp.google.com/eng/doc/devguide/proto/news/v26.md#JSON and
2699579

This should be WAI on protobuf's side, but looks like a MessageToJson wrapper (in your code? or gRPC's?) simply needs to be updated to set the always_print_fields_with_no_presence argument instead when calling json_format.MessageToJson. Did this code mean to pass on always_print_fields_with_no_presence instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants