eclipse-uprotocol / up-transport-zenoh-python

Python uPClient implementation for the Zenoh transport
Apache License 2.0
0 stars 3 forks source link

Wrong check of payload.value in invoke_method function #9

Open oleg-budylin opened 3 months ago

oleg-budylin commented 3 months ago

Get the data from UPayload

if not payload.value:
    msg = "The data in UPayload should be Data::Value"
    logging.debug(f"{msg}")
    raise UStatus(code=UCode.INVALID_ARGUMENT, message=msg)

payload.value may be empty, so it is better to check with

if payload.value is None:
neelam-kushwah commented 3 months ago

If payload.value is None, the condition not payload.value will also return True.

oleg-budylin commented 3 months ago

If payload.value is None, the condition not payload.value will also return True.

exactly, but (not payload.value) is True for payload.value = {} or [] or ""