mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 18:33:44 +03:00
Make sure to return a bytes string from numeric range adapter
This commit is contained in:
parent
d159dfea9d
commit
fc2ca0d2e9
|
@ -415,7 +415,7 @@ class NumberRangeAdapter(RangeAdapter):
|
||||||
def getquoted(self):
|
def getquoted(self):
|
||||||
r = self.adapted
|
r = self.adapted
|
||||||
if r.isempty:
|
if r.isempty:
|
||||||
return "'empty'"
|
return b("'empty'")
|
||||||
|
|
||||||
if not r.lower_inf:
|
if not r.lower_inf:
|
||||||
# not exactly: we are relying that none of these object is really
|
# not exactly: we are relying that none of these object is really
|
||||||
|
@ -431,8 +431,8 @@ class NumberRangeAdapter(RangeAdapter):
|
||||||
else:
|
else:
|
||||||
upper = ''
|
upper = ''
|
||||||
|
|
||||||
return b("'%s%s,%s%s'" % (
|
return ("'%s%s,%s%s'" % (
|
||||||
r._bounds[0], lower, upper, r._bounds[1]))
|
r._bounds[0], lower, upper, r._bounds[1])).encode('ascii')
|
||||||
|
|
||||||
# TODO: probably won't work with infs, nans and other tricky cases.
|
# TODO: probably won't work with infs, nans and other tricky cases.
|
||||||
register_adapter(NumericRange, NumberRangeAdapter)
|
register_adapter(NumericRange, NumberRangeAdapter)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user