summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trove/common/stream_codecs.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/trove/common/stream_codecs.py b/trove/common/stream_codecs.py
index 752dbb9..a85d6c6 100644
--- a/trove/common/stream_codecs.py
+++ b/trove/common/stream_codecs.py
@@ -342,7 +342,14 @@ class PropertiesCodec(StreamCodec):
342 342
343 if self._unpack_singletons: 343 if self._unpack_singletons:
344 # Unpack singleton values. 344 # Unpack singleton values.
345 for k, v in data_dict.items(): 345 # NOTE(zhaochao): In Python 3.x, dict.items() returns a view
346 # object, which will reflect the changes of the dict itself:
347 # https://docs.python.org/3/library/stdtypes.html#dict-views
348 # This means as we're changing the dict, dict.items() cannot
349 # guarantee we're safely iterating all entries in the dict.
350 # Manually converting the result of dict.items() to a list will
351 # fix.
352 for k, v in list(data_dict.items()):
346 data_dict.update({k: trove_utils.unpack_singleton(v)}) 353 data_dict.update({k: trove_utils.unpack_singleton(v)})
347 354
348 return data_dict 355 return data_dict