From fc2ca0d2e99599a702621f26236dc3e22c22350f Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 21 Apr 2013 20:30:03 +0100 Subject: [PATCH] Make sure to return a bytes string from numeric range adapter --- lib/_range.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_range.py b/lib/_range.py index 25600d84..306f1f73 100644 --- a/lib/_range.py +++ b/lib/_range.py @@ -415,7 +415,7 @@ class NumberRangeAdapter(RangeAdapter): def getquoted(self): r = self.adapted if r.isempty: - return "'empty'" + return b("'empty'") if not r.lower_inf: # not exactly: we are relying that none of these object is really @@ -431,8 +431,8 @@ class NumberRangeAdapter(RangeAdapter): else: upper = '' - return b("'%s%s,%s%s'" % ( - r._bounds[0], lower, upper, r._bounds[1])) + return ("'%s%s,%s%s'" % ( + r._bounds[0], lower, upper, r._bounds[1])).encode('ascii') # TODO: probably won't work with infs, nans and other tricky cases. register_adapter(NumericRange, NumberRangeAdapter)