eclipse-zenoh / zenoh-python

Python API for zenoh
http://zenoh.io
Other
76 stars 39 forks source link

[Bug] Parameters __iter__() does not return an iterator in 1.0.0 #363

Closed fsteff closed 1 month ago

fsteff commented 1 month ago

Describe the bug

With version 1.0.0 the Query Parameters __iter__() function returns a list[tuple[str,str]] instead of an iterator. (previously I would call decode_parameters())

Example for retrieving all parameters:

def handle_query(query: zenoh.Query):
   params = list(query.parameters)

causes the error TypeError: iter() returned non-iterator of type 'list'

Currently a workaround for this is calling __iter__() manually

def handle_query(query: zenoh.Query):
   params = list(query.parameters.__iter__())

To reproduce

import zenoh
list(zenoh.Parameters({'k': 'v'}))

System info