mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
RFE #567972: Socket objects' family, type and proto properties are
now exposed via new get...() methods.
This commit is contained in:
parent
5c170fd4a9
commit
bc45a3f821
5 changed files with 55 additions and 2 deletions
|
@ -183,6 +183,24 @@ class _socketobject(object):
|
|||
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
|
||||
|
||||
_s = ("def %s(self, *args): return self._sock.%s(*args)\n\n"
|
||||
"%s.__doc__ = _realsocket.%s.__doc__\n")
|
||||
for _m in _socketmethods:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue