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

fixed: ... oneof fields only works for the last specified field #171 #172

Closed
wants to merge 2 commits into from

Conversation

Alesh
Copy link

@Alesh Alesh commented Aug 16, 2024

Hi Pavel, I made a correction for myself, and in my case it worked. The project's tests also passed.

Copy link

codecov bot commented Aug 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.95%. Comparing base (4e89f71) to head (a065101).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #172   +/-   ##
=======================================
  Coverage   97.95%   97.95%           
=======================================
  Files          30       30           
  Lines         784      784           
=======================================
  Hits          768      768           
  Misses         16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

one_of = descriptor.one_of
if one_of is not None:
one_of._keep_attribute(self, descriptor.number)
if descriptor := (value is not None and self.__PROTOBUF_FIELDS_BY_NAME__.get(name)):
Copy link
Owner

@eigenein eigenein Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission!

There's one major concern here: __PROTOBUF_FIELDS_BY_NAME__ must always contain a descriptor for the name, so calling .get() here might potentially mask a bug.

Also, the value is not None should've been outside the descriptor assignment.

Not to worry, I'll make a new PR and also add a test

eigenein added a commit that referenced this pull request Aug 16, 2024
@eigenein eigenein added the bug label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants