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
serialized_on_wire throws when comparing against another variant.
E.g.
@dataclass(eq=False, repr=False)
class AOrB(betterproto.Message):
some_a: "A" = (
betterproto.message_field(1, group="element")
)
some_b: "B" = (
betterproto.message_field(2, group="element")
)
elem = AOrB(
some_a=A()
)
assert betterproto.serialized_on_wire(elem.some_a) # ok
assert not betterproto.serialized_on_wire(elem.some_b)
# line above throws AttributeError: 'element' is set to 'some_a', not 'some_b'
Expected Results
No crash like in version 2.2.0b6. This doesn't happen with the last preview release.
Actual Results
throws AttributeError: 'element' is set to 'some_a', not 'some_b'
System Information
Command not found: protoc # using grpcio_tools
Python 3.9.16
Name: betterproto
Version: 2.0.0b99 # custom poetry build from betterproto = { git = "https://github.com/danielgtaylor/python-betterproto.git", rev = "5fdd0bb"}
Summary: A better Protobuf / gRPC generator & library
Home-page: https://github.com/danielgtaylor/python-betterproto
Author: Daniel G. Taylor
Author-email: danielgtaylor@gmail.com
License: MIT
Location: /Users/.../Library/Caches/pypoetry/virtualenvs/...-py3.9/lib/python3.9/site-packages
Requires: grpclib, python-dateutil, typing-extensions
Required-by: ...
Checklist
I have searched the issues for duplicates.
I have shown the entire traceback, if possible.
I have verified this issue occurs on the latest prelease of betterproto which can be installed using pip install -U --pre betterproto, if possible.
The text was updated successfully, but these errors were encountered:
Summary
serialized_on_wire on main is broken for oneOfs
Reproduction Steps
serialized_on_wire
throws when comparing against another variant.E.g.
Expected Results
No crash like in version 2.2.0b6. This doesn't happen with the last preview release.
Actual Results
throws AttributeError: 'element' is set to 'some_a', not 'some_b'
System Information
Command not found: protoc # using grpcio_tools
Python 3.9.16
Name: betterproto
Version: 2.0.0b99 # custom poetry build from betterproto = { git = "https://github.com/danielgtaylor/python-betterproto.git", rev = "5fdd0bb"}
Summary: A better Protobuf / gRPC generator & library
Home-page: https://github.com/danielgtaylor/python-betterproto
Author: Daniel G. Taylor
Author-email: danielgtaylor@gmail.com
License: MIT
Location: /Users/.../Library/Caches/pypoetry/virtualenvs/...-py3.9/lib/python3.9/site-packages
Requires: grpclib, python-dateutil, typing-extensions
Required-by: ...
Checklist
pip install -U --pre betterproto
, if possible.The text was updated successfully, but these errors were encountered: