summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-03-17 19:17:34 (GMT)
committerGeorg Brandl <georg@python.org>2006-03-17 19:17:34 (GMT)
commitbc45a3f8210213986e12dfecd7c12b8a45b4f16b (patch)
tree290112e792ae1587f3c2db552975f8e06de05d4c /Modules/socketmodule.c
parent5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa (diff)
downloadcpython-bc45a3f8210213986e12dfecd7c12b8a45b4f16b.zip
cpython-bc45a3f8210213986e12dfecd7c12b8a45b4f16b.tar.gz
cpython-bc45a3f8210213986e12dfecd7c12b8a45b4f16b.tar.bz2
RFE #567972: Socket objects' family, type and proto properties are
now exposed via new get...() methods.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index c526d75..6ba076a 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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 */