-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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)): |
There was a problem hiding this comment.
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
Hi Pavel, I made a correction for myself, and in my case it worked. The project's tests also passed.