mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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,8 +41,8 @@ fill_free_list(void)
|
|||
p = &((PyFloatBlock *)p)->objects[0];
|
||||
q = p + N_FLOATOBJECTS;
|
||||
while (--q > p)
|
||||
q->ob_type = (struct _typeobject *)(q-1);
|
||||
q->ob_type = NULL;
|
||||
Py_Type(q) = (struct _typeobject *)(q-1);
|
||||
Py_Type(q) = NULL;
|
||||
return p + N_FLOATOBJECTS - 1;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ PyFloat_FromDouble(double fval)
|
|||
}
|
||||
/* Inline PyObject_New */
|
||||
op = free_list;
|
||||
free_list = (PyFloatObject *)op->ob_type;
|
||||
free_list = (PyFloatObject *)Py_Type(op);
|
||||
PyObject_INIT(op, &PyFloat_Type);
|
||||
op->ob_fval = fval;
|
||||
return (PyObject *) op;
|
||||
|
@ -156,11 +156,11 @@ static void
|
|||
float_dealloc(PyFloatObject *op)
|
||||
{
|
||||
if (PyFloat_CheckExact(op)) {
|
||||
op->ob_type = (struct _typeobject *)free_list;
|
||||
Py_Type(op) = (struct _typeobject *)free_list;
|
||||
free_list = op;
|
||||
}
|
||||
else
|
||||
op->ob_type->tp_free((PyObject *)op);
|
||||
Py_Type(op)->tp_free((PyObject *)op);
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -178,7 +178,7 @@ PyFloat_AsDouble(PyObject *op)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if ((nb = op->ob_type->tp_as_number) == NULL || nb->nb_float == NULL) {
|
||||
if ((nb = Py_Type(op)->tp_as_number) == NULL || nb->nb_float == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "a float is required");
|
||||
return -1;
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ float_getformat(PyTypeObject *v, PyObject* arg)
|
|||
if (!PyString_Check(arg)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"__getformat__() argument must be string, not %.500s",
|
||||
arg->ob_type->tp_name);
|
||||
Py_Type(arg)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
s = PyString_AS_STRING(arg);
|
||||
|
@ -1044,8 +1044,7 @@ static PyNumberMethods float_as_number = {
|
|||
};
|
||||
|
||||
PyTypeObject PyFloat_Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"float",
|
||||
sizeof(PyFloatObject),
|
||||
0,
|
||||
|
@ -1156,7 +1155,7 @@ PyFloat_Fini(void)
|
|||
for (i = 0, p = &list->objects[0];
|
||||
i < N_FLOATOBJECTS;
|
||||
i++, p++) {
|
||||
if (PyFloat_CheckExact(p) && p->ob_refcnt != 0)
|
||||
if (PyFloat_CheckExact(p) && Py_Refcnt(p) != 0)
|
||||
frem++;
|
||||
}
|
||||
next = list->next;
|
||||
|
@ -1167,8 +1166,8 @@ PyFloat_Fini(void)
|
|||
i < N_FLOATOBJECTS;
|
||||
i++, p++) {
|
||||
if (!PyFloat_CheckExact(p) ||
|
||||
p->ob_refcnt == 0) {
|
||||
p->ob_type = (struct _typeobject *)
|
||||
Py_Refcnt(p) == 0) {
|
||||
Py_Type(p) = (struct _typeobject *)
|
||||
free_list;
|
||||
free_list = p;
|
||||
}
|
||||
|
@ -1200,7 +1199,7 @@ PyFloat_Fini(void)
|
|||
i < N_FLOATOBJECTS;
|
||||
i++, p++) {
|
||||
if (PyFloat_CheckExact(p) &&
|
||||
p->ob_refcnt != 0) {
|
||||
Py_Refcnt(p) != 0) {
|
||||
char buf[100];
|
||||
format_float(buf, sizeof(buf), p, PREC_STR);
|
||||
/* XXX(twouters) cast refcount to
|
||||
|
@ -1209,7 +1208,7 @@ PyFloat_Fini(void)
|
|||
*/
|
||||
fprintf(stderr,
|
||||
"# <float at %p, refcnt=%ld, val=%s>\n",
|
||||
p, (long)p->ob_refcnt, buf);
|
||||
p, (long)Py_Refcnt(p), buf);
|
||||
}
|
||||
}
|
||||
list = list->next;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue