summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-01-04 11:00:45 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-01-04 11:00:45 (GMT)
commitc3a51ecb8518540625034ff07f9d518e0f84e7ac (patch)
tree385ce77578dfe018983aefc822158a04c7709449 /Lib/socket.py
parent8848c7a37f929b471267bd893f91c3b818fafce0 (diff)
downloadcpython-c3a51ecb8518540625034ff07f9d518e0f84e7ac.zip
cpython-c3a51ecb8518540625034ff07f9d518e0f84e7ac.tar.gz
cpython-c3a51ecb8518540625034ff07f9d518e0f84e7ac.tar.bz2
Issue #10819: SocketIO.name property returns -1 when its closed, instead of
raising a ValueError, to fix repr().
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 2dc9736..d0da740 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -307,7 +307,10 @@ class SocketIO(io.RawIOBase):
@property
def name(self):
- return self.fileno()
+ if not self.closed:
+ return self.fileno()
+ else:
+ return -1
@property
def mode(self):