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

bug(python): _AddEqualsMethod calls _InternalUnpackAny which uses deprecated python MessageFactory #17345

Open
parthea opened this issue Jul 5, 2024 · 2 comments
Assignees
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days. python

Comments

@parthea
Copy link

parthea commented Jul 5, 2024

What version of protobuf and what language are you using?
Version: main/v3.6.0/v3.5.0 etc. (NOTE: please try updating to the latest version of protoc/runtime possible beforehand to attempt to resolve your problem)
Language: C++/Java/Python/C#/Ruby/PHP/Objective-C/Javascript
Protobuf @ HEAD
Python

What operating system (Linux, Windows, ...) and version?
Linux 6.6.15-2rodete2-amd64

What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.9.16
gcc 13.2.0

What did you do?
Steps to reproduce the behavior:

  1. Clone https://github.com/googleapis/python-logging.git
  2. Install the library with pip install .
  3. Run PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest tests/unit/test__gapic.py::Test__log_entry_mapping_to_pb
  4. See warning below which shows that deprecated function is used in the protobuf API in equals operation
>       self.assertEqual(result, entry_pb)

tests/unit/test__gapic.py:709: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/proto/message.py:871: in __eq__
    return self._pb == other._pb
../../.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/google/protobuf/internal/python_message.py:980: in __eq__
    if not self.ListFields() == other.ListFields():
../../.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/google/protobuf/internal/python_message.py:975: in __eq__
    any_a = _InternalUnpackAny(self)
../../.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/google/protobuf/internal/python_message.py:957: in _InternalUnpackAny
    message_class = factory.GetPrototype(descriptor)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <google.protobuf.symbol_database.SymbolDatabase object at 0x7f417fd17040>, descriptor = <google.protobuf.descriptor.Descriptor object at 0x7f417e4114f0>

    def GetPrototype(self, descriptor):
>     warnings.warn('SymbolDatabase.GetPrototype() is deprecated. Please '
                    'use message_factory.GetMessageClass() instead. '
                    'SymbolDatabase.GetPrototype() will be removed soon.')
E     UserWarning: SymbolDatabase.GetPrototype() is deprecated. Please use message_factory.GetMessageClass() instead. SymbolDatabase.GetPrototype() will be removed soon.

../../.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/google/protobuf/symbol_database.py:55: UserWarning
==================================================================================================== short test summary info =====================================================================================================
FAILED tests/unit/test__gapic.py::Test__log_entry_mapping_to_pb::test_registered_type - UserWarning: SymbolDatabase.GetPrototype() is deprecated. Please use message_factory.GetMessageClass() instead. SymbolDatabase.GetPrototype() will be removed soon.
===========================

See usage of function MessageFactory.GetPrototype below which was deprecated in c80e7ef

message_class = factory.GetPrototype(descriptor)

What did you expect to see

I didn't expect to see any warnings as my application code does not contain usage of the functions deprecated in c80e7ef

What did you see instead?

I saw

SymbolDatabase.GetPrototype() is deprecated. Please use message_factory.GetMessageClass() instead. SymbolDatabase.GetPrototype() will be removed soon.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment

Please let me know if more information is required.

@parthea parthea added the untriaged auto added to all issues by default when created. label Jul 5, 2024
parthea added a commit to googleapis/python-logging that referenced this issue Jul 5, 2024
parthea added a commit to googleapis/python-logging that referenced this issue Jul 9, 2024
…910)

* chore(python): Use latest python runtime in prerelease_deps session

Source-Link: googleapis/synthtool@14d8b28
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5651442a6336971a2fb2df40fb56b3337df67cafa14c0809cc89cb34ccee1b8e

* See protocolbuffers/protobuf#17345

* add comment

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
@zhangskz zhangskz added python and removed untriaged auto added to all issues by default when created. labels Jul 17, 2024
@zhangskz
Copy link
Member

@anandolee Can you update _InternalUnpackAny to move off of the deprecated API?

Copy link

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 inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Denotes the issue/PR has not seen activity in the last 90 days. python
Projects
None yet
Development

No branches or pull requests

3 participants