mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Merged revisions 56467-56482 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ................ r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines Merged revisions 56466-56476 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines PEP 3123: Provide forward compatibility with Python 3.0, while keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT. ........ ................ r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines PEP 3123: Use proper C inheritance for PyObject. ................ r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines Add longintrepr.h to Python.h, so that the compiler can see that PyFalse is really some kind of PyObject*. ................ r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines Qualify SHIFT, MASK, BASE. ................ r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines Correctly refer to _ob_next. ................
This commit is contained in:
parent
b972a78e17
commit
9f2e346911
134 changed files with 1388 additions and 1577 deletions
|
@ -41,7 +41,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);
|
||||
|
@ -64,7 +64,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
|
||||
|
@ -94,7 +94,7 @@ BaseException_repr(PyBaseExceptionObject *self)
|
|||
char *name;
|
||||
char *dot;
|
||||
|
||||
name = (char *)self->ob_type->tp_name;
|
||||
name = (char *)Py_Type(self)->tp_name;
|
||||
dot = strrchr(name, '.');
|
||||
if (dot != NULL) name = dot+1;
|
||||
|
||||
|
@ -106,9 +106,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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -207,8 +207,7 @@ static PyGetSetDef BaseException_getset[] = {
|
|||
|
||||
|
||||
static PyTypeObject _PyExc_BaseException = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /*ob_size*/
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"BaseException", /*tp_name*/
|
||||
sizeof(PyBaseExceptionObject), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
|
@ -258,8 +257,7 @@ PyObject *PyExc_BaseException = (PyObject *)&_PyExc_BaseException;
|
|||
*/
|
||||
#define SimpleExtendsException(EXCBASE, EXCNAME, EXCDOC) \
|
||||
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
||||
PyObject_HEAD_INIT(NULL) \
|
||||
0, \
|
||||
PyVarObject_HEAD_INIT(NULL, 0) \
|
||||
# EXCNAME, \
|
||||
sizeof(PyBaseExceptionObject), \
|
||||
0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \
|
||||
|
@ -274,8 +272,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
|
|||
|
||||
#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
|
||||
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
||||
PyObject_HEAD_INIT(NULL) \
|
||||
0, \
|
||||
PyVarObject_HEAD_INIT(NULL, 0) \
|
||||
# EXCNAME, \
|
||||
sizeof(Py ## EXCSTORE ## Object), \
|
||||
0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
|
@ -290,8 +287,7 @@ PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME
|
|||
|
||||
#define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDEALLOC, EXCMETHODS, EXCMEMBERS, EXCSTR, EXCDOC) \
|
||||
static PyTypeObject _PyExc_ ## EXCNAME = { \
|
||||
PyObject_HEAD_INIT(NULL) \
|
||||
0, \
|
||||
PyVarObject_HEAD_INIT(NULL, 0) \
|
||||
# EXCNAME, \
|
||||
sizeof(Py ## EXCSTORE ## Object), 0, \
|
||||
(destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
|
@ -369,7 +365,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
|
||||
|
@ -474,7 +470,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
|
||||
|
@ -540,9 +536,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;
|
||||
}
|
||||
|
@ -595,7 +591,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
|
||||
|
@ -793,7 +789,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
|
||||
|
@ -1244,7 +1240,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
|
||||
|
@ -1316,8 +1312,7 @@ UnicodeEncodeError_str(PyObject *self)
|
|||
}
|
||||
|
||||
static PyTypeObject _PyExc_UnicodeEncodeError = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"UnicodeEncodeError",
|
||||
sizeof(PyUnicodeErrorObject), 0,
|
||||
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -1378,8 +1373,7 @@ UnicodeDecodeError_str(PyObject *self)
|
|||
}
|
||||
|
||||
static PyTypeObject _PyExc_UnicodeDecodeError = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"UnicodeDecodeError",
|
||||
sizeof(PyUnicodeErrorObject), 0,
|
||||
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -1465,8 +1459,7 @@ UnicodeTranslateError_str(PyObject *self)
|
|||
}
|
||||
|
||||
static PyTypeObject _PyExc_UnicodeTranslateError = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"UnicodeTranslateError",
|
||||
sizeof(PyUnicodeErrorObject), 0,
|
||||
(destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue