Skip to content

Commit 272edfc

Browse files
author
James William Pye
committed
Accommodate for __import__ differences.
1 parent 8e839ab commit 272edfc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

postgresql/types/io/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
provides an abstraction for quad-word based times used by some configurations of
1515
PostgreSQL.
1616
"""
17+
import sys
1718
from itertools import cycle, chain
1819
from ... import types as pg_types
1920

@@ -91,8 +92,12 @@
9192
))
9293
)
9394

94-
def load(relmod):
95-
return __import__(__name__ + '.' + relmod, fromlist = True, level = 1)
95+
if sys.version_info[:2] < (3,3):
96+
def load(relmod):
97+
return __import__(__name__ + '.' + relmod, fromlist = True, level = 1)
98+
else:
99+
def load(relmod):
100+
return __import__(relmod, globals = globals(), locals = locals(), fromlist = [''], level = 1)
96101

97102
def resolve(oid):
98103
io = module_io.get(oid)

0 commit comments

Comments
 (0)