summaryrefslogtreecommitdiff
path: root/lib/extensions.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-08-15 01:55:57 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-08-15 01:56:36 +0100
commit78649f8e905f04c3000abef23725d557a103abef (patch)
tree60afa4c1829f9a0068ae9ea34ef3374eb86fd0f8 /lib/extensions.py
parent3b41c3a6f373af0100a399cea150a9420ecc4acb (diff)
downloadpsycopg2-78649f8e905f04c3000abef23725d557a103abef.tar.gz
Dropped use of b() "macro" and 2to3 fixer
Just use the b"" strings syntax supported from python 2.6.
Diffstat (limited to 'lib/extensions.py')
-rw-r--r--lib/extensions.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/extensions.py b/lib/extensions.py
index 2130098..309c6ee 100644
--- a/lib/extensions.py
+++ b/lib/extensions.py
@@ -103,15 +103,6 @@ TRANSACTION_STATUS_INERROR = 3
TRANSACTION_STATUS_UNKNOWN = 4
-# Return bytes from a string
-if _sys.version_info[0] < 3:
- def b(s):
- return s
-else:
- def b(s):
- return s.encode('utf8')
-
-
def register_adapter(typ, callable):
"""Register 'callable' as an ISQLQuote adapter for type 'typ'."""
adapters[(typ, ISQLQuote)] = callable
@@ -136,7 +127,7 @@ class SQL_IN(object):
if hasattr(obj, 'prepare'):
obj.prepare(self._conn)
qobjs = [o.getquoted() for o in pobjs]
- return b('(') + b(', ').join(qobjs) + b(')')
+ return b'(' + b', '.join(qobjs) + b')'
def __str__(self):
return str(self.getquoted())
@@ -151,7 +142,7 @@ class NoneAdapter(object):
def __init__(self, obj):
pass
- def getquoted(self, _null=b("NULL")):
+ def getquoted(self, _null=b"NULL"):
return _null