You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Python Protobuf 5.27.0rc1
What operating system (Linux, Windows, ...) and version?
Debian GNU/Linux rodete
6.6.15-2rodete2-amd64
What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.9.16
gcc version 13.2.0 (Debian 13.2.0-10)
Run the code below which results in ImportError from google._upb._message import MessageMapContainer
What did you expect to see
I expected from google._upb._message import MessageMapContainer to succeed as it works in 5.26.1
(py392) partheniou@partheniou-vm-3:$ python3
Python 3.9.16 (main, Mar 2 2023, 17:52:22)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google._upb._message import MessageMapContainer
>>> import google.protobuf
>>> google.protobuf.__version__
'5.26.1'
(py392) partheniou@partheniou-vm-3:~$ python3
Python 3.9.16 (main, Mar 2 2023, 17:52:22)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google._upb._message import MessageMapContainer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'MessageMapContainer' from 'google._upb._message' (/usr/local/google/home/partheniou/.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/google/_upb/_message.abi3.so)
>>> import google.protobuf
>>> google.protobuf.__version__
'5.27.0rc1'
What did you see instead?
>>> from google._upb._message import MessageMapContainer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'MessageMapContainer' from 'google._upb._message' (/usr/local/google/home/partheniou/.pyenv/versions/3.9.16/envs/py392/lib/python3.9/site-packages/google/_upb/_message.abi3.so)
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
The text was updated successfully, but these errors were encountered:
from google._upb._message import MessageMapContainer which import internal type is not a use case we want to support. The reason to import the container is mostly check if a field is repeated, the right way is use field descriptor instead like:
if field_des.label == descriptor.FieldDescriptor.LABEL_REPEATED:
if field_des.message_type:
// It is a repeated message
else:
// It is a repeated scalar
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
Python Protobuf 5.27.0rc1
What operating system (Linux, Windows, ...) and version?
Debian GNU/Linux rodete
6.6.15-2rodete2-amd64
What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.9.16
gcc version 13.2.0 (Debian 13.2.0-10)
What did you do?
Steps to reproduce the behavior:
foo.proto
protoc --python_out=. foo.proto
<class 'google._upb._message.MessageMapContainer'>
from google._upb._message import MessageMapContainer
What did you expect to see
I expected
from google._upb._message import MessageMapContainer
to succeed as it works in5.26.1
What did you see instead?
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
The text was updated successfully, but these errors were encountered: