Skip to content

Commit a4111c4

Browse files
author
James William Pye
committed
Fix case where errno is not present or not an integer.
OSError().strerror should always be present.
1 parent 1ba84c2 commit a4111c4

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

postgresql/python/socket.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ def fatal_exception_message(typ, err) -> (str, None):
4848
"""
4949
if typ.try_again(err):
5050
return None
51-
strerr = getattr(err, 'strerror', None)
52-
if strerr is not None:
53-
return str(strerr)
54-
return os.strerror(err.errno)
51+
return getattr(err, 'strerror', '<strerror not present>')
5552

5653
def secure(self, socket : socket.socket) -> ssl.SSLSocket:
5754
"secure a socket with SSL"

0 commit comments

Comments
 (0)