summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-07-21 06:55:02 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-07-21 06:55:02 (GMT)
commit6819210b9e4e5719a6f7f9c1725f8fa70a8936f6 (patch)
tree456e2e6b3d9d71e966f3b0e419ecfe44ce3c1fdd /Objects/exceptions.c
parentb1994b4a5d0139a010eb0af1d6615a3df92fe786 (diff)
downloadcpython-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.zip
cpython-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.tar.gz
cpython-6819210b9e4e5719a6f7f9c1725f8fa70a8936f6.tar.bz2
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 9bf0e1c..3d79383 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -56,7 +56,7 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int
BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
{
- if (!_PyArg_NoKeywords(self->ob_type->tp_name, kwds))
+ if (!_PyArg_NoKeywords(Py_Type(self)->tp_name, kwds))
return -1;
Py_DECREF(self->args);
@@ -85,7 +85,7 @@ BaseException_dealloc(PyBaseExceptionObject *self)
{
_PyObject_GC_UNTRACK(self);
BaseException_clear(self);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
static int
@@ -129,7 +129,7 @@ BaseException_repr(PyBaseExceptionObject *self)
if (!repr_suffix)
return NULL;
- name = (char *)self->ob_type->tp_name;
+ name = (char *)Py_Type(self)->tp_name;
dot = strrchr(name, '.');
if (dot != NULL) name = dot+1;
@@ -148,9 +148,9 @@ static PyObject *
BaseException_reduce(PyBaseExceptionObject *self)
{
if (self->args && self->dict)
- return PyTuple_Pack(3, self->ob_type, self->args, self->dict);
+ return PyTuple_Pack(3, Py_Type(self), self->args, self->dict);
else
- return PyTuple_Pack(2, self->ob_type, self->args);
+ return PyTuple_Pack(2, Py_Type(self), self->args);
}
/*
@@ -478,7 +478,7 @@ SystemExit_dealloc(PySystemExitObject *self)
{
_PyObject_GC_UNTRACK(self);
SystemExit_clear(self);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
static int
@@ -583,7 +583,7 @@ EnvironmentError_dealloc(PyEnvironmentErrorObject *self)
{
_PyObject_GC_UNTRACK(self);
EnvironmentError_clear(self);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
static int
@@ -725,9 +725,9 @@ EnvironmentError_reduce(PyEnvironmentErrorObject *self)
Py_INCREF(args);
if (self->dict)
- res = PyTuple_Pack(3, self->ob_type, args, self->dict);
+ res = PyTuple_Pack(3, Py_Type(self), args, self->dict);
else
- res = PyTuple_Pack(2, self->ob_type, args);
+ res = PyTuple_Pack(2, Py_Type(self), args);
Py_DECREF(args);
return res;
}
@@ -780,7 +780,7 @@ WindowsError_dealloc(PyWindowsErrorObject *self)
{
_PyObject_GC_UNTRACK(self);
WindowsError_clear(self);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
static int
@@ -1054,7 +1054,7 @@ SyntaxError_dealloc(PySyntaxErrorObject *self)
{
_PyObject_GC_UNTRACK(self);
SyntaxError_clear(self);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
static int
@@ -1532,7 +1532,7 @@ UnicodeError_dealloc(PyUnicodeErrorObject *self)
{
_PyObject_GC_UNTRACK(self);
UnicodeError_clear(self);
- self->ob_type->tp_free((PyObject *)self);
+ Py_Type(self)->tp_free((PyObject *)self);
}
static int