Repository: avro Updated Branches: refs/heads/branch-1.8 628457545 -> 338b443f0
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/fb7f023d Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/fb7f023d Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/fb7f023d Branch: refs/heads/branch-1.8 Commit: fb7f023daf40c6373dc60db436fe302c70805493 Parents: 6284575 Author: Ryan Blue <[email protected]> Authored: Thu Jun 2 08:36:17 2016 -0700 Committer: Ryan Blue <[email protected]> Committed: Sat Nov 5 13:13:01 2016 -0700 ---------------------------------------------------------------------- CHANGES.txt | 15 +++++++++++++++ lang/py3/avro/datafile.py | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/avro/blob/fb7f023d/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 352c0cd..7ec6a3e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,20 @@ Avro Change Log +Trunk (not yet released) + + INCOMPATIBLE CHANGES + + NEW FEATURES + + OPTIMIZATIONS + + IMPROVEMENTS + + 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/fb7f023d/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)
