diff options
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 97ca816..d319ca3 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1245,7 +1245,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, PyExc_TypeError, "getsockaddrarg: " "AF_NETLINK address must be tuple, not %.500s", - args->ob_type->tp_name); + Py_Type(args)->tp_name); return 0; } if (!PyArg_ParseTuple(args, "II:getsockaddrarg", &pid, &groups)) @@ -1268,7 +1268,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, PyExc_TypeError, "getsockaddrarg: " "AF_INET address must be tuple, not %.500s", - args->ob_type->tp_name); + Py_Type(args)->tp_name); return 0; } if (!PyArg_ParseTuple(args, "eti:getsockaddrarg", @@ -1298,7 +1298,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, PyExc_TypeError, "getsockaddrarg: " "AF_INET6 address must be tuple, not %.500s", - args->ob_type->tp_name); + Py_Type(args)->tp_name); return 0; } if (!PyArg_ParseTuple(args, "eti|ii", @@ -1420,7 +1420,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, PyExc_TypeError, "getsockaddrarg: " "AF_PACKET address must be tuple, not %.500s", - args->ob_type->tp_name); + Py_Type(args)->tp_name); return 0; } if (!PyArg_ParseTuple(args, "si|iis#", &interfaceName, @@ -2843,7 +2843,7 @@ sock_dealloc(PySocketSockObject *s) { if (s->sock_fd != -1) (void) SOCKETCLOSE(s->sock_fd); - s->ob_type->tp_free((PyObject *)s); + Py_Type(s)->tp_free((PyObject *)s); } @@ -2928,8 +2928,7 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) /* Type object for socket objects. */ static PyTypeObject sock_type = { - PyObject_HEAD_INIT(0) /* Must fill in type value later */ - 0, /* ob_size */ + PyVarObject_HEAD_INIT(0, 0) /* Must fill in type value later */ "_socket.socket", /* tp_name */ sizeof(PySocketSockObject), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -3555,7 +3554,7 @@ socket_ntohl(PyObject *self, PyObject *arg) else return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", - arg->ob_type->tp_name); + Py_Type(arg)->tp_name); if (x == (unsigned long) -1 && PyErr_Occurred()) return NULL; return PyLong_FromUnsignedLong(ntohl(x)); @@ -3624,7 +3623,7 @@ socket_htonl(PyObject *self, PyObject *arg) else return PyErr_Format(PyExc_TypeError, "expected int/long, %s found", - arg->ob_type->tp_name); + Py_Type(arg)->tp_name); return PyLong_FromUnsignedLong(htonl((unsigned long)x)); } @@ -4274,7 +4273,7 @@ init_socket(void) if (!os_init()) return; - sock_type.ob_type = &PyType_Type; + Py_Type(&sock_type) = &PyType_Type; m = Py_InitModule3(PySocket_MODULE_NAME, socket_methods, socket_doc); |