#1874 - Adjust for Python2/3 incompatibilities

This commit is contained in:
Bert Blommers 2019-10-06 15:24:37 +01:00 committed by GitHub
parent dc89b47b40
commit a389fdcd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,7 +153,7 @@ class LimitedSizeDict(dict):
self.update(*args, **kwargs)
def __setitem__(self, key, value):
current_item_size = sum([item.size() if type(item) == DynamoType else bytesize(str(item)) for item in (self.keys() + self.values())])
current_item_size = sum([item.size() if type(item) == DynamoType else bytesize(str(item)) for item in (list(self.keys()) + list(self.values()))])
new_item_size = bytesize(key) + (value.size() if type(value) == DynamoType else bytesize(str(value)))
# Official limit is set to 400000 (400KB)
# Manual testing confirms that the actual limit is between 409 and 410KB