mercator icon indicating copy to clipboard operation
mercator copied to clipboard

Bug while using ProtoList with builtin type

Open nitoqq opened this issue 5 years ago • 0 comments

Example

class SomeMessage(ProtoMapping):
    __proto__ = api_pb2.SomeMessage

    array_of_integers = ProtoList('array_of_integers', int)


SomeMessage({'array_of_integers': (1, 2, 3)}).to_protobuf()

there's an error raised

ERROR    grpc._server:_server.py:444 Exception calling application: int() argument must be a string, a bytes-like object or a number, not 'tuple' while casting "(1, 2, 3)" (tuple) to int
Traceback (most recent call last):
  File ".../src/mercator/mercator/meta.py", line 53, in cast
    return self.target_type(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

nitoqq avatar Nov 20 '19 01:11 nitoqq