summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-09 16:14:21 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-09 16:14:21 (GMT)
commit7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a (patch)
treed25489e9531c01f1e9244012bbfaa929f382883e /Objects/weakrefobject.c
parentb7d943625cf4353f6cb72df16252759f2dbd8e06 (diff)
downloadcpython-7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a.zip
cpython-7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a.tar.gz
cpython-7f14f0d8a0228c50d5b5de2acbfe9a64ebc6749a.tar.bz2
Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c116
1 files changed, 58 insertions, 58 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 27f015d..f43b68d 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -57,9 +57,9 @@ clear_weakref(PyWeakReference *self)
PyWeakref_GET_OBJECT(self));
if (*list == self)
- /* If 'self' is the end of the list (and thus self->wr_next == NULL)
- then the weakref list itself (and thus the value of *list) will
- end up being set to NULL. */
+ /* If 'self' is the end of the list (and thus self->wr_next == NULL)
+ then the weakref list itself (and thus the value of *list) will
+ end up being set to NULL. */
*list = self->wr_next;
self->wr_object = Py_None;
if (self->wr_prev != NULL)
@@ -161,21 +161,21 @@ weakref_repr(PyWeakReference *self)
PyOS_snprintf(buffer, sizeof(buffer), "<weakref at %p; dead>", self);
}
else {
- char *name = NULL;
- PyObject *nameobj = PyObject_GetAttrString(PyWeakref_GET_OBJECT(self),
- "__name__");
- if (nameobj == NULL)
- PyErr_Clear();
- else if (PyUnicode_Check(nameobj))
- name = _PyUnicode_AsString(nameobj);
+ char *name = NULL;
+ PyObject *nameobj = PyObject_GetAttrString(PyWeakref_GET_OBJECT(self),
+ "__name__");
+ if (nameobj == NULL)
+ PyErr_Clear();
+ else if (PyUnicode_Check(nameobj))
+ name = _PyUnicode_AsString(nameobj);
PyOS_snprintf(buffer, sizeof(buffer),
- name ? "<weakref at %p; to '%.50s' at %p (%s)>"
- : "<weakref at %p; to '%.50s' at %p>",
- self,
- Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name,
- PyWeakref_GET_OBJECT(self),
- name);
- Py_XDECREF(nameobj);
+ name ? "<weakref at %p; to '%.50s' at %p (%s)>"
+ : "<weakref at %p; to '%.50s' at %p>",
+ self,
+ Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name,
+ PyWeakref_GET_OBJECT(self),
+ name);
+ Py_XDECREF(nameobj);
}
return PyUnicode_FromString(buffer);
}
@@ -188,8 +188,8 @@ static PyObject *
weakref_richcompare(PyWeakReference* self, PyWeakReference* other, int op)
{
if ((op != Py_EQ && op != Py_NE) ||
- !PyWeakref_Check(self) ||
- !PyWeakref_Check(other)) {
+ !PyWeakref_Check(self) ||
+ !PyWeakref_Check(other)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
@@ -339,10 +339,10 @@ _PyWeakref_RefType = {
sizeof(PyWeakReference),
0,
weakref_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
+ 0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_reserved*/
+ 0, /*tp_reserved*/
(reprfunc)weakref_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
@@ -358,7 +358,7 @@ _PyWeakref_RefType = {
0, /*tp_doc*/
(traverseproc)gc_traverse, /*tp_traverse*/
(inquiry)gc_clear, /*tp_clear*/
- (richcmpfunc)weakref_richcompare, /*tp_richcompare*/
+ (richcmpfunc)weakref_richcompare, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
@@ -438,9 +438,9 @@ proxy_checkref(PyWeakReference *proxy)
#define WRAP_METHOD(method, special) \
static PyObject * \
method(PyObject *proxy) { \
- UNWRAP(proxy); \
- return PyObject_CallMethod(proxy, special, ""); \
- }
+ UNWRAP(proxy); \
+ return PyObject_CallMethod(proxy, special, ""); \
+ }
/* direct slots */
@@ -454,9 +454,9 @@ proxy_repr(PyWeakReference *proxy)
{
char buf[160];
PyOS_snprintf(buf, sizeof(buf),
- "<weakproxy at %p to %.100s at %p>", proxy,
- Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name,
- PyWeakref_GET_OBJECT(proxy));
+ "<weakproxy at %p to %.100s at %p>", proxy,
+ Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name,
+ PyWeakref_GET_OBJECT(proxy));
return PyUnicode_FromString(buf);
}
@@ -587,8 +587,8 @@ WRAP_METHOD(proxy_bytes, "__bytes__");
static PyMethodDef proxy_methods[] = {
- {"__bytes__", (PyCFunction)proxy_bytes, METH_NOARGS},
- {NULL, NULL}
+ {"__bytes__", (PyCFunction)proxy_bytes, METH_NOARGS},
+ {NULL, NULL}
};
@@ -636,7 +636,7 @@ static PySequenceMethods proxy_as_sequence = {
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
- 0, /*sq_ass_slice*/
+ 0, /*sq_ass_slice*/
(objobjproc)proxy_contains, /* sq_contains */
};
@@ -655,20 +655,20 @@ _PyWeakref_ProxyType = {
0,
/* methods */
(destructor)proxy_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- (reprfunc)proxy_repr, /* tp_repr */
- &proxy_as_number, /* tp_as_number */
- &proxy_as_sequence, /* tp_as_sequence */
- &proxy_as_mapping, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ (reprfunc)proxy_repr, /* tp_repr */
+ &proxy_as_number, /* tp_as_number */
+ &proxy_as_sequence, /* tp_as_sequence */
+ &proxy_as_mapping, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
proxy_str, /* tp_str */
proxy_getattr, /* tp_getattro */
(setattrofunc)proxy_setattr, /* tp_setattro */
- 0, /* tp_as_buffer */
+ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
0, /* tp_doc */
(traverseproc)gc_traverse, /* tp_traverse */
@@ -677,7 +677,7 @@ _PyWeakref_ProxyType = {
0, /* tp_weaklistoffset */
(getiterfunc)proxy_iter, /* tp_iter */
(iternextfunc)proxy_iternext, /* tp_iternext */
- proxy_methods, /* tp_methods */
+ proxy_methods, /* tp_methods */
};
@@ -689,20 +689,20 @@ _PyWeakref_CallableProxyType = {
0,
/* methods */
(destructor)proxy_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- (unaryfunc)proxy_repr, /* tp_repr */
- &proxy_as_number, /* tp_as_number */
- &proxy_as_sequence, /* tp_as_sequence */
- &proxy_as_mapping, /* tp_as_mapping */
- 0, /* tp_hash */
- proxy_call, /* tp_call */
- proxy_str, /* tp_str */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ (unaryfunc)proxy_repr, /* tp_repr */
+ &proxy_as_number, /* tp_as_number */
+ &proxy_as_sequence, /* tp_as_sequence */
+ &proxy_as_mapping, /* tp_as_mapping */
+ 0, /* tp_hash */
+ proxy_call, /* tp_call */
+ proxy_str, /* tp_str */
proxy_getattr, /* tp_getattro */
(setattrofunc)proxy_setattr, /* tp_setattro */
- 0, /* tp_as_buffer */
+ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
0, /* tp_doc */
(traverseproc)gc_traverse, /* tp_traverse */
@@ -724,7 +724,7 @@ PyWeakref_NewRef(PyObject *ob, PyObject *callback)
if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) {
PyErr_Format(PyExc_TypeError,
- "cannot create weak reference to '%s' object",
+ "cannot create weak reference to '%s' object",
Py_TYPE(ob)->tp_name);
return NULL;
}
@@ -783,7 +783,7 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) {
PyErr_Format(PyExc_TypeError,
- "cannot create weak reference to '%s' object",
+ "cannot create weak reference to '%s' object",
Py_TYPE(ob)->tp_name);
return NULL;
}
@@ -908,7 +908,7 @@ PyObject_ClearWeakRefs(PyObject *object)
else {
PyObject *tuple;
Py_ssize_t i = 0;
-
+
tuple = PyTuple_New(count * 2);
if (tuple == NULL) {
if (restore_error)