summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-11-20 23:15:52 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-11-20 23:15:52 (GMT)
commit9d24ff027fe93e702d95d95dd520096d4c5a9fc2 (patch)
treef8bfa79c552858445f7bb8284c6b41b8dfe5e3ef /Lib/socket.py
parent304da2113892eb1a96c7976b44891bb3396c8adc (diff)
downloadcpython-9d24ff027fe93e702d95d95dd520096d4c5a9fc2.zip
cpython-9d24ff027fe93e702d95d95dd520096d4c5a9fc2.tar.gz
cpython-9d24ff027fe93e702d95d95dd520096d4c5a9fc2.tar.bz2
Follow-up of r67300: correct a failure in socket.makefile().
SocketIO objects now always have 'name' and 'mode' attributes.
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index fcbc545..5578b13 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -149,8 +149,6 @@ class socket(_socket.socket):
if buffering == 0:
if not binary:
raise ValueError("unbuffered streams must be binary")
- raw.name = self.fileno()
- raw.mode = mode
return raw
if reading and writing:
buffer = io.BufferedRWPair(raw, raw, buffering)
@@ -160,11 +158,8 @@ class socket(_socket.socket):
assert writing
buffer = io.BufferedWriter(raw, buffering)
if binary:
- buffer.name = self.fileno()
- buffer.mode = mode
return buffer
text = io.TextIOWrapper(buffer, encoding, newline)
- text.name = self.fileno()
text.mode = mode
return text
@@ -230,6 +225,14 @@ class SocketIO(io.RawIOBase):
def fileno(self):
return self._sock.fileno()
+ @property
+ def name(self):
+ return self._sock.fileno()
+
+ @property
+ def mode(self):
+ return self._mode
+
def close(self):
if self.closed:
return