-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Python ServiceDescriptor.FindMethodByName raises exception (inconsistent behavior between C extension and native Python + documentation) #9592
Comments
@anandolee - please see my comment above
I'm willing to do the legwork to fix this, but I want to check first that this is the right direction. |
change pure python to raise key error is right direction. Thank you tomerv |
…buffers#9592) * Align Python version with C-extension version (python/google/protobuf/pyext/descriptor.cc) * Update documentation accordingly * Add unit test
…buffers#9592) * Align Python version with C-extension version (python/google/protobuf/pyext/descriptor.cc) * Update documentation accordingly * Add unit test
Raise KeyError in Python ServiceDescriptor.FindMethodByName (#9592)
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it. This issue was closed and archived because there has been no new activity in the 14 days since the |
What version of protobuf and what language are you using?
Version: master
Language: Python
What operating system (Linux, Windows, ...) and version?
Ubuntu 20
What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.8.10
What did you do?
This raises a KeyError exception.
However, the documentation says:
More specifically, the native Python implementation & documentation is:
While the C-extension implementation is:
Note the
PyExc_KeyError
part in this code.What did you expect to see
Consistency between Python and C-extension implementation (and the documentation).
What did you see instead?
They are not consistent.
Despite the title, I tend to think that the exception is the more correct behavior, based on these aspects:
python/google/protobuf/internal/descriptor_pool_test.py
, while there are no corresponding tests forServiceDescriptor.FindMethodByName
.I can try to submit a patch, but I want to check first that this is the correct direction, i.e. change the native Python code to raise an exception, update the documentation accordingly, and add an appropriate test.
The text was updated successfully, but these errors were encountered: