summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes/_ctypes.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-10-23 17:20:21 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-10-23 17:20:21 (GMT)
commit09fcb72048be60435ae70ec2c3e23e2325edb421 (patch)
treeee7c279b7b77ff5d58f831b37fb517f28d65398a /Modules/_ctypes/_ctypes.c
parentd5d0bc35adc6c043d5985152451505e70d869341 (diff)
downloadcpython-09fcb72048be60435ae70ec2c3e23e2325edb421.zip
cpython-09fcb72048be60435ae70ec2c3e23e2325edb421.tar.gz
cpython-09fcb72048be60435ae70ec2c3e23e2325edb421.tar.bz2
Issue #19356: Avoid using a C variabled named "_self", it's a reserved word in some C compilers.
Diffstat (limited to 'Modules/_ctypes/_ctypes.c')
-rw-r--r--Modules/_ctypes/_ctypes.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 9a37aac..7d0d258 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -143,18 +143,18 @@ typedef struct {
} DictRemoverObject;
static void
-_DictRemover_dealloc(PyObject *_self)
+_DictRemover_dealloc(PyObject *myself)
{
- DictRemoverObject *self = (DictRemoverObject *)_self;
+ DictRemoverObject *self = (DictRemoverObject *)myself;
Py_XDECREF(self->key);
Py_XDECREF(self->dict);
- Py_TYPE(self)->tp_free(_self);
+ Py_TYPE(self)->tp_free(myself);
}
static PyObject *
-_DictRemover_call(PyObject *_self, PyObject *args, PyObject *kw)
+_DictRemover_call(PyObject *myself, PyObject *args, PyObject *kw)
{
- DictRemoverObject *self = (DictRemoverObject *)_self;
+ DictRemoverObject *self = (DictRemoverObject *)myself;
if (self->key && self->dict) {
if (-1 == PyDict_DelItem(self->dict, self->key))
/* XXX Error context */
@@ -2471,17 +2471,17 @@ static PyMemberDef PyCData_members[] = {
{ NULL },
};
-static int PyCData_NewGetBuffer(PyObject *_self, Py_buffer *view, int flags)
+static int PyCData_NewGetBuffer(PyObject *myself, Py_buffer *view, int flags)
{
- CDataObject *self = (CDataObject *)_self;
- StgDictObject *dict = PyObject_stgdict(_self);
+ CDataObject *self = (CDataObject *)myself;
+ StgDictObject *dict = PyObject_stgdict(myself);
Py_ssize_t i;
if (view == NULL) return 0;
view->buf = self->b_ptr;
- view->obj = _self;
- Py_INCREF(_self);
+ view->obj = myself;
+ Py_INCREF(myself);
view->len = self->b_size;
view->readonly = 0;
/* use default format character if not set */
@@ -2516,36 +2516,36 @@ PyCData_nohash(PyObject *self)
}
static PyObject *
-PyCData_reduce(PyObject *_self, PyObject *args)
+PyCData_reduce(PyObject *myself, PyObject *args)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
- if (PyObject_stgdict(_self)->flags & (TYPEFLAG_ISPOINTER|TYPEFLAG_HASPOINTER)) {
+ if (PyObject_stgdict(myself)->flags & (TYPEFLAG_ISPOINTER|TYPEFLAG_HASPOINTER)) {
PyErr_SetString(PyExc_ValueError,
"ctypes objects containing pointers cannot be pickled");
return NULL;
}
return Py_BuildValue("O(O(NN))",
_unpickle,
- Py_TYPE(_self),
- PyObject_GetAttrString(_self, "__dict__"),
+ Py_TYPE(myself),
+ PyObject_GetAttrString(myself, "__dict__"),
PyBytes_FromStringAndSize(self->b_ptr, self->b_size));
}
static PyObject *
-PyCData_setstate(PyObject *_self, PyObject *args)
+PyCData_setstate(PyObject *myself, PyObject *args)
{
void *data;
Py_ssize_t len;
int res;
PyObject *dict, *mydict;
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
if (!PyArg_ParseTuple(args, "Os#", &dict, &data, &len))
return NULL;
if (len > self->b_size)
len = self->b_size;
memmove(self->b_ptr, data, len);
- mydict = PyObject_GetAttrString(_self, "__dict__");
+ mydict = PyObject_GetAttrString(myself, "__dict__");
res = PyDict_Update(mydict, dict);
Py_DECREF(mydict);
if (res == -1)
@@ -4183,9 +4183,9 @@ Array_init(CDataObject *self, PyObject *args, PyObject *kw)
}
static PyObject *
-Array_item(PyObject *_self, Py_ssize_t index)
+Array_item(PyObject *myself, Py_ssize_t index)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
Py_ssize_t offset, size;
StgDictObject *stgdict;
@@ -4209,9 +4209,9 @@ Array_item(PyObject *_self, Py_ssize_t index)
}
static PyObject *
-Array_subscript(PyObject *_self, PyObject *item)
+Array_subscript(PyObject *myself, PyObject *item)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -4220,7 +4220,7 @@ Array_subscript(PyObject *_self, PyObject *item)
return NULL;
if (i < 0)
i += self->b_length;
- return Array_item(_self, i);
+ return Array_item(myself, i);
}
else if PySlice_Check(item) {
StgDictObject *stgdict, *itemdict;
@@ -4297,7 +4297,7 @@ Array_subscript(PyObject *_self, PyObject *item)
for (cur = start, i = 0; i < slicelen;
cur += step, i++) {
- PyObject *v = Array_item(_self, cur);
+ PyObject *v = Array_item(myself, cur);
PyList_SET_ITEM(np, i, v);
}
return np;
@@ -4311,9 +4311,9 @@ Array_subscript(PyObject *_self, PyObject *item)
}
static int
-Array_ass_item(PyObject *_self, Py_ssize_t index, PyObject *value)
+Array_ass_item(PyObject *myself, Py_ssize_t index, PyObject *value)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
Py_ssize_t size, offset;
StgDictObject *stgdict;
char *ptr;
@@ -4340,9 +4340,9 @@ Array_ass_item(PyObject *_self, Py_ssize_t index, PyObject *value)
}
static int
-Array_ass_subscript(PyObject *_self, PyObject *item, PyObject *value)
+Array_ass_subscript(PyObject *myself, PyObject *item, PyObject *value)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
@@ -4357,7 +4357,7 @@ Array_ass_subscript(PyObject *_self, PyObject *item, PyObject *value)
return -1;
if (i < 0)
i += self->b_length;
- return Array_ass_item(_self, i, value);
+ return Array_ass_item(myself, i, value);
}
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelen, otherlen, i, cur;
@@ -4382,7 +4382,7 @@ Array_ass_subscript(PyObject *_self, PyObject *item, PyObject *value)
int result;
if (item == NULL)
return -1;
- result = Array_ass_item(_self, cur, item);
+ result = Array_ass_item(myself, cur, item);
Py_DECREF(item);
if (result == -1)
return -1;
@@ -4397,9 +4397,9 @@ Array_ass_subscript(PyObject *_self, PyObject *item, PyObject *value)
}
static Py_ssize_t
-Array_length(PyObject *_self)
+Array_length(PyObject *myself)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
return self->b_length;
}
@@ -4685,9 +4685,9 @@ static PyTypeObject Simple_Type = {
PyCPointer_Type
*/
static PyObject *
-Pointer_item(PyObject *_self, Py_ssize_t index)
+Pointer_item(PyObject *myself, Py_ssize_t index)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
Py_ssize_t size;
Py_ssize_t offset;
StgDictObject *stgdict, *itemdict;
@@ -4716,9 +4716,9 @@ Pointer_item(PyObject *_self, Py_ssize_t index)
}
static int
-Pointer_ass_item(PyObject *_self, Py_ssize_t index, PyObject *value)
+Pointer_ass_item(PyObject *myself, Py_ssize_t index, PyObject *value)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
Py_ssize_t size;
Py_ssize_t offset;
StgDictObject *stgdict, *itemdict;
@@ -4848,14 +4848,14 @@ Pointer_new(PyTypeObject *type, PyObject *args, PyObject *kw)
}
static PyObject *
-Pointer_subscript(PyObject *_self, PyObject *item)
+Pointer_subscript(PyObject *myself, PyObject *item)
{
- CDataObject *self = (CDataObject *)_self;
+ CDataObject *self = (CDataObject *)myself;
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
- return Pointer_item(_self, i);
+ return Pointer_item(myself, i);
}
else if (PySlice_Check(item)) {
PySliceObject *slice = (PySliceObject *)item;
@@ -4968,7 +4968,7 @@ Pointer_subscript(PyObject *_self, PyObject *item)
return NULL;
for (cur = start, i = 0; i < len; cur += step, i++) {
- PyObject *v = Pointer_item(_self, cur);
+ PyObject *v = Pointer_item(myself, cur);
PyList_SET_ITEM(np, i, v);
}
return np;