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

Message.to_dict() argument always_print_fields_with_no_presence has no effect on Windows #483

Closed
silvanocerza opened this issue Sep 5, 2024 · 3 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@silvanocerza
Copy link

silvanocerza commented Sep 5, 2024

Environment details

  • Programming language: Python
  • OS: Windows
  • Language runtime version: CPython >=3.8
  • Package version: latest 1.24.0

Steps to reproduce

  1. pip install proto-plus
  2. Create an instance of any Message without setting all fields
  3. Call type(message).to_dict(message, always_print_fields_with_no_presence=False)

Fields that are not set will still be present in the returned dictionary, even if always_print_fields_with_no_presence should prevent that.

This happens only on Windows with protobuf>=5.28, pinning protobuf to <5.28 prevents it.

I created a small repo to reproduce the issue.
https://github.com/silvanocerza/protobuf-bug

See workflow runs that reproduce the issue: https://github.com/silvanocerza/protobuf-bug/actions/runs/10723276739

@silvanocerza silvanocerza added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 5, 2024
@parthea parthea self-assigned this Sep 5, 2024
@esrauchg
Copy link

esrauchg commented Sep 6, 2024

Thanks for bug report and clean reproduction!

Can you clarify that this does reproduce exactly only on Windows? We're investigating another very deep issue related to python on windows and I'm trying to see how likely this is to be another symptom of that.

copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this issue Sep 6, 2024
Fixes #18045

This should also cover googleapis/proto-plus-python#483 once we release it.

PiperOrigin-RevId: 671925586
copybara-service bot pushed a commit to protocolbuffers/protobuf that referenced this issue Sep 7, 2024
Fixes #18045

This should also cover googleapis/proto-plus-python#483 once we release it.

PiperOrigin-RevId: 671934556
mkruskal-google pushed a commit to protocolbuffers/protobuf that referenced this issue Sep 7, 2024
Fixes #18045

This should also cover googleapis/proto-plus-python#483 once we release it.

PiperOrigin-RevId: 671934556
mkruskal-google added a commit to protocolbuffers/protobuf that referenced this issue Sep 7, 2024
* upb: fix uninitialized upb_MessageValue buffer bugs

Fixes #18045

This should also cover googleapis/proto-plus-python#483 once we release it.

PiperOrigin-RevId: 671934556

* Regenerate stale files

---------

Co-authored-by: Eric Salo <salo@google.com>
@parthea
Copy link
Contributor

parthea commented Sep 7, 2024

Fixed via protocolbuffers/protobuf#18160

@parthea parthea closed this as completed Sep 7, 2024
@silvanocerza
Copy link
Author

silvanocerza commented Sep 9, 2024

Thanks for bug report and clean reproduction!

Can you clarify that this does reproduce exactly only on Windows? We're investigating another very deep issue related to python on windows and I'm trying to see how likely this is to be another symptom of that.

Yup, only Windows.

But I see I'm late to answer. :)

Thanks for the quick fix by the way, I'll be waiting for release. Is there an ETA for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants