Skip to content

Commit e818e10

Browse files
committed
Merge pull request #45 from gratipay/import-tweak
use cleaner test for Python major version
2 parents bb4e7b4 + 22015bc commit e818e10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

postgres/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
from __future__ import absolute_import, division, print_function, unicode_literals
158158

159159
import sys
160-
try: # Python 2
160+
if sys.version_info[0] == 2: # Python 2
161161
import urlparse
162162

163163
# "Note: In Python 2, if you want to uniformly receive all your database
@@ -169,7 +169,7 @@
169169
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
170170
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
171171

172-
except ImportError: # Python 3
172+
else: # Python 3
173173
import urllib.parse as urlparse
174174
from collections import namedtuple
175175

0 commit comments

Comments
 (0)