8000 betterproto.serialized_on_wire(..) on main is broken · Issue #592 · danielgtaylor/python-betterproto · GitHub
[go: up one dir, main page]

Skip to content
8000

betterproto.serialized_on_wire(..) on main is broken #592

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

Closed
3 tasks done
heimalne opened this issue Aug 6, 2024 · 1 comment
Closed
3 tasks done

betterproto.serialized_on_wire(..) on main is broken #592

heimalne opened this issue Aug 6, 2024 · 1 comment
Labels
wontfix This will not be worked on

Comments

@heimalne
Copy link
heimalne commented Aug 6, 2024

Summary

serialized_on_wire on main is broken for oneOfs

Reproduction Steps

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.
@heimalne heimalne added bug Something isn't working investigation needed labels Aug 6, 2024
@Gobot1234
Copy link
Collaborator

This is intentional see #510

@Gobot1234 Gobot1234 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2024
@Gobot1234 Gobot1234 added wontfix This will not be worked on and removed bug Something isn't working investigation needed labels Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants
0