You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by bl...@apache.org on 2016/06/02 15:38:38 UTC
avro git commit: AVRO-1741: Py3: Fix error when codec is not in the
header. Contributed by Matthew Hayes.
Repository: avro
Updated Branches:
refs/heads/master ae3b78f7d -> 191badb80
AVRO-1741: Py3: Fix error when codec is not in the header. Contributed by Matthew Hayes.
This happens when the compression codec is None, meaning the
"null"/uncompressed codec.
Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/191badb8
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/191badb8
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/191badb8
Branch: refs/heads/master
Commit: 191badb80281498611ffcbc0e79b9b020a3d5096
Parents: ae3b78f
Author: Ryan Blue <bl...@apache.org>
Authored: Thu Jun 2 08:36:17 2016 -0700
Committer: Ryan Blue <bl...@apache.org>
Committed: Thu Jun 2 08:38:31 2016 -0700
----------------------------------------------------------------------
CHANGES.txt | 3 +++
lang/py3/avro/datafile.py | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/avro/blob/191badb8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 020b523..37ff25c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -12,6 +12,9 @@ Trunk (not yet released)
BUG FIXES
+ AVRO-1741: Python3: Fix error when codec is not in the header.
+ (Matthew Hayes via blue)
+
Avro 1.8.1 (14 May 2016)
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/avro/blob/191badb8/lang/py3/avro/datafile.py
----------------------------------------------------------------------
diff --git a/lang/py3/avro/datafile.py b/lang/py3/avro/datafile.py
index fc93fe1..7894d79 100644
--- a/lang/py3/avro/datafile.py
+++ b/lang/py3/avro/datafile.py
@@ -349,9 +349,11 @@ class DataFileReader(object):
self._read_header()
# ensure codec is valid
- self.codec = self.GetMeta('avro.codec').decode('utf-8')
- if self.codec is None:
+ avro_codec_raw = self.GetMeta('avro.codec')
+ if avro_codec_raw is None:
self.codec = "null"
+ else:
+ self.codec = avro_codec_raw.decode('utf-8')
if self.codec not in VALID_CODECS:
raise DataFileException('Unknown codec: %s.' % self.codec)