Skip to content

Commit 083b953

Browse files
author
James William Pye
committed
Don't try to set stdstrings if it's 8.1
Also, don't depend on ipaddr objects for client_address.
1 parent 1a3bcd5 commit 083b953

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

postgresql/driver/pq3.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,17 +1923,13 @@ def connect(self):
19231923
# pythons without ipaddr will likely give strings.
19241924
ca = r.get('client_addr')
19251925
if ca is not None:
1926-
if not isinstance(ca, str):
1927-
# it better be a ipaddr.BaseIP..
1928-
self.client_address = ca.ip_ext
1929-
else:
1930-
self.client_address = ca
1926+
self.client_address = ca.split('/')[0]
19311927
self.client_port = r.get('client_port')
19321928
self.backend_start = r.get('backend_start')
19331929
##
19341930
# Set standard_conforming_strings
19351931
scstr = self.settings.get('standard_conforming_strings')
1936-
if scstr is None:
1932+
if scstr is None or (self.version_info[0] == 8 and self.version_info[1] == 1):
19371933
# warn about non-standard strings
19381934
cm = element.ClientNotice(
19391935
message = 'standard conforming strings are not available',

0 commit comments

Comments
 (0)