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

Add GetDebugString to Python FileDescriptor interface. #7498

Merged

Conversation

psobot
Copy link
Contributor

@psobot psobot commented May 13, 2020

Closes #7484.

This PR exposes the C++ FileDescriptor DebugString method through to the Python C++ implementation, and adds a test for it.

@psobot
Copy link
Contributor Author

psobot commented May 22, 2020

Not sure if there's any etiquette about tagging reviewers here, but I'm not sure whose attention to ask for for review. @TeBoring / @anandolee - you've reviewed one of my Python PRs before, any thoughts on who might be able to review this?

@deannagarcia
Copy link
Member

Sorry for the delay and thanks for the contribution. Right now, this PR is failing a few python tests with this error: Traceback (most recent call last): File "/tmp/protobuf/protobuf/python/google/protobuf/internal/descriptor_test.py", line 147, in testGetDebugString self.assertEqual(self.my_file.GetDebugString(), TEST_FILE_DESCRIPTOR_DEBUG) AttributeError: 'FileDescriptor' object has no attribute 'GetDebugString'. If you want to take a look and fix it, I can review this and hopefully get it merged.

@psobot psobot force-pushed the add-python-descriptor-debug-string branch from e246c68 to ef0bd13 Compare October 15, 2021 15:39
@psobot
Copy link
Contributor Author

psobot commented Oct 15, 2021

Thanks @deannagarcia! I've made an update that should fix things (although in the nearly two years since this pull request was opened, my local development environment can no longer run the tests cleanly without a bit more work).

Comment on lines +146 to +152
@unittest.skipIf(
api_implementation.Type() != 'cpp',
'GetDebugString is only available with the cpp implementation',
)
def testGetDebugString(self):
self.assertEqual(self.my_file.GetDebugString(), TEST_FILE_DESCRIPTOR_DEBUG)

Copy link

Choose a reason for hiding this comment

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

shouldn't this test be executed in python too as this PR merged that feature?
(sry just needed that feature and debugged on an older python-protobuf and stumbled over this PR, pls just ignore if everything is as it should be :)!

copybara-service bot pushed a commit that referenced this pull request Oct 30, 2024
…hon cpp extension.

cpp extension added the API in #7498
Pure python and upb do not support it and filtered out the test
This API does not exists in any other language except C++.

PiperOrigin-RevId: 686192076
copybara-service bot pushed a commit that referenced this pull request Oct 31, 2024
…hon cpp extension.

cpp extension added the API in #7498
Pure python and upb do not support it and filtered out the test
This API does not exists in any other language except C++.

PiperOrigin-RevId: 686192076
copybara-service bot pushed a commit that referenced this pull request Oct 31, 2024
…hon cpp extension.

cpp extension added the API in #7498
Pure python and upb do not support it and filtered out the test
This API does not exists in any other language except C++.

PiperOrigin-RevId: 691870623
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Descriptor's DebugString method(s) not exposed in Python API
6 participants