From 2748cd6b8db8cb9c549b9a9dae1e6889c4995739 Mon Sep 17 00:00:00 2001 From: linyicong Date: Wed, 17 Sep 2014 15:33:15 +0800 Subject: [PATCH] fix a unresolved reference bug --- python/pyspark/mllib/_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/pyspark/mllib/_common.py b/python/pyspark/mllib/_common.py index 68f603361672..70425793dead 100644 --- a/python/pyspark/mllib/_common.py +++ b/python/pyspark/mllib/_common.py @@ -198,7 +198,8 @@ def _deserialize_double(ba, offset=0): """ if type(ba) != bytearray: raise TypeError("_deserialize_double called on a %s; wanted bytearray" % type(ba)) - if len(ba) - offset != 8: + nb = len(ba) - offset + if nb != 8: raise TypeError("_deserialize_double called on a %d-byte array; wanted 8 bytes." % nb) return _unpack("d", ba[offset:])[0]