mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Correct API design mistake from rev. 43126: make socket attributes readonly properties.
This commit is contained in:
parent
9ca8789ee3
commit
bb03ac0dae
3 changed files with 28 additions and 38 deletions
|
|
@ -182,24 +182,10 @@ class _socketobject(object):
|
|||
Return a regular file object corresponding to the socket. The mode
|
||||
and bufsize arguments are as for the built-in open() function."""
|
||||
return _fileobject(self._sock, mode, bufsize)
|
||||
|
||||
def getfamily(self):
|
||||
"""getfamily() -> socket family
|
||||
|
||||
Return the socket family."""
|
||||
return self._sock.family
|
||||
|
||||
def gettype(self):
|
||||
"""gettype() -> socket type
|
||||
|
||||
Return the socket type."""
|
||||
return self._sock.type
|
||||
|
||||
def getproto(self):
|
||||
"""getproto() -> socket protocol
|
||||
|
||||
Return the socket protocol."""
|
||||
return self._sock.proto
|
||||
|
||||
family = property(lambda self: self._sock.family, doc="the socket family")
|
||||
type = property(lambda self: self._sock.type, doc="the socket type")
|
||||
proto = property(lambda self: self._sock.proto, doc="the socket protocol")
|
||||
|
||||
_s = ("def %s(self, *args): return self._sock.%s(*args)\n\n"
|
||||
"%s.__doc__ = _realsocket.%s.__doc__\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue