mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +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
|
@ -62,6 +62,7 @@ Local naming conventions:
|
|||
*/
|
||||
|
||||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
|
||||
#undef MAX
|
||||
#define MAX(x, y) ((x) < (y) ? (y) : (x))
|
||||
|
@ -2502,6 +2503,14 @@ static PyMethodDef sock_methods[] = {
|
|||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
/* SockObject members */
|
||||
static PyMemberDef sock_memberlist[] = {
|
||||
{"family", T_INT, offsetof(PySocketSockObject, sock_family), READONLY, "the socket family"},
|
||||
{"type", T_INT, offsetof(PySocketSockObject, sock_type), READONLY, "the socket type"},
|
||||
{"proto", T_INT, offsetof(PySocketSockObject, sock_proto), READONLY, "the socket protocol"},
|
||||
{"timeout", T_DOUBLE, offsetof(PySocketSockObject, sock_timeout), READONLY, "the socket timeout"},
|
||||
{0},
|
||||
};
|
||||
|
||||
/* Deallocate a socket object in response to the last Py_DECREF().
|
||||
First close the file description. */
|
||||
|
@ -2625,7 +2634,7 @@ static PyTypeObject sock_type = {
|
|||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
sock_methods, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
sock_memberlist, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue