Remove support for Python 2. Fixes #5443

pull/33/head
Dave Page 2020-05-04 14:58:49 +01:00
parent cf31d0187b
commit 04d6d4e2cc
2 changed files with 3 additions and 11 deletions

View File

@ -13,6 +13,7 @@ New features
Housekeeping
************
| `Issue #5443 <https://redmine.postgresql.org/issues/5443>`_ - Remove support for Python 2.
| `Issue #5444 <https://redmine.postgresql.org/issues/5444>`_ - Cleanup Python detection in the runtime project file.
Bug fixes

View File

@ -120,22 +120,13 @@ class ServerManager(object):
res['ver'] = self.ver
res['sversion'] = self.sversion
if hasattr(self, 'password') and self.password:
# If running under PY2
if hasattr(self.password, 'decode'):
res['password'] = self.password.decode('utf-8')
else:
res['password'] = str(self.password)
res['password'] = str(self.password)
else:
res['password'] = self.password
if self.use_ssh_tunnel:
if hasattr(self, 'tunnel_password') and self.tunnel_password:
# If running under PY2
if hasattr(self.tunnel_password, 'decode'):
res['tunnel_password'] = \
self.tunnel_password.decode('utf-8')
else:
res['tunnel_password'] = str(self.tunnel_password)
res['tunnel_password'] = str(self.tunnel_password)
else:
res['tunnel_password'] = self.tunnel_password