Skip to content

Commit

Permalink
Code review: 334530043: Fix serializer for Python 3 and prevent Pytho…
Browse files Browse the repository at this point in the history
…n 3 tests from hanging.
  • Loading branch information
puccia authored and joachimmetz committed Mar 7, 2018
1 parent 79dc824 commit 8db11b4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/dpkg/changelog
Expand Up @@ -2,4 +2,4 @@ plaso (20180306-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline <log2timeline-dev@googlegroups.com> Tue, 06 Mar 2018 12:18:10 +0100
-- Log2Timeline <log2timeline-dev@googlegroups.com> Tue, 06 Mar 2018 17:38:44 -0800
14 changes: 12 additions & 2 deletions plaso/storage/interface.py
Expand Up @@ -341,7 +341,12 @@ def _DeserializeAttributeContainer(self, container_type, serialized_data):
if self._serializers_profiler:
self._serializers_profiler.StartTiming(container_type)

attribute_container = self._serializer.ReadSerialized(serialized_data)
try:
serialized_string = serialized_data.decode('utf-8')
except UnicodeDecodeError as exception:
raise IOError('Unable to decode serialized data: {0!s}'.format(
exception))
attribute_container = self._serializer.ReadSerialized(serialized_string)

if self._serializers_profiler:
self._serializers_profiler.StopTiming(container_type)
Expand Down Expand Up @@ -537,7 +542,12 @@ def _DeserializeAttributeContainer(self, container_type, serialized_data):
if self._serializers_profiler:
self._serializers_profiler.StartTiming(container_type)

attribute_container = self._serializer.ReadSerialized(serialized_data)
try:
serialized_string = serialized_data.decode('utf-8')
except UnicodeDecodeError as exception:
raise IOError('Unable to decode serialized data: {0!s}'.format(
exception))
attribute_container = self._serializer.ReadSerialized(serialized_string)

if self._serializers_profiler:
self._serializers_profiler.StopTiming(container_type)
Expand Down
2 changes: 1 addition & 1 deletion run_tests.py
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to run the tests."""

Expand Down

0 comments on commit 8db11b4

Please sign in to comment.