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.
................
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 1399d19..bf031bb 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -338,7 +338,7 @@
else {
PyMem_DEL(unicode->str);
Py_XDECREF(unicode->defenc);
- unicode->ob_type->tp_free((PyObject *)unicode);
+ Py_Type(unicode)->tp_free((PyObject *)unicode);
}
}
@@ -352,7 +352,7 @@
return -1;
}
v = (PyUnicodeObject *)*unicode;
- if (v == NULL || !PyUnicode_Check(v) || v->ob_refcnt != 1 || length < 0) {
+ if (v == NULL || !PyUnicode_Check(v) || Py_Refcnt(v) != 1 || length < 0) {
PyErr_BadInternalCall();
return -1;
}
@@ -1004,7 +1004,7 @@
PyErr_Format(PyExc_TypeError,
"coercing to Unicode: need string or buffer, "
"%.80s found",
- obj->ob_type->tp_name);
+ Py_Type(obj)->tp_name);
goto onError;
}
@@ -1054,7 +1054,7 @@
if (!PyUnicode_Check(unicode)) {
PyErr_Format(PyExc_TypeError,
"decoder did not return an unicode object (type=%.400s)",
- unicode->ob_type->tp_name);
+ Py_Type(unicode)->tp_name);
Py_DECREF(unicode);
goto onError;
}
@@ -3722,8 +3722,7 @@
}
static PyTypeObject EncodingMapType = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"EncodingMap", /*tp_name*/
sizeof(struct encoding_map), /*tp_basicsize*/
0, /*tp_itemsize*/
@@ -3984,7 +3983,7 @@
char *outstart;
Py_ssize_t outsize = PyBytes_GET_SIZE(outobj);
- if (mapping->ob_type == &EncodingMapType) {
+ if (Py_Type(mapping) == &EncodingMapType) {
int res = encoding_map_lookup(c, mapping);
Py_ssize_t requiredsize = *outpos+1;
if (res == -1)
@@ -4056,7 +4055,7 @@
/* find all unencodable characters */
while (collendpos < size) {
PyObject *rep;
- if (mapping->ob_type == &EncodingMapType) {
+ if (Py_Type(mapping) == &EncodingMapType) {
int res = encoding_map_lookup(p[collendpos], mapping);
if (res != -1)
break;
@@ -5114,7 +5113,7 @@
PyErr_Format(PyExc_TypeError,
"sequence item %zd: expected string or Unicode,"
" %.80s found",
- i, item->ob_type->tp_name);
+ i, Py_Type(item)->tp_name);
goto onError;
}
item = PyUnicode_FromObject(item);
@@ -6155,7 +6154,7 @@
PyErr_Format(PyExc_TypeError,
"encoder did not return a bytes object "
"(type=%.400s)",
- v->ob_type->tp_name);
+ Py_Type(v)->tp_name);
Py_DECREF(v);
return NULL;
}
@@ -6191,7 +6190,7 @@
PyErr_Format(PyExc_TypeError,
"decoder did not return a string/unicode object "
"(type=%.400s)",
- v->ob_type->tp_name);
+ Py_Type(v)->tp_name);
Py_DECREF(v);
return NULL;
}
@@ -8134,7 +8133,7 @@
arglen = -1;
argidx = -2;
}
- if (args->ob_type->tp_as_mapping && !PyTuple_Check(args) &&
+ if (Py_Type(args)->tp_as_mapping && !PyTuple_Check(args) &&
!PyObject_TypeCheck(args, &PyBaseString_Type))
dict = args;
@@ -8604,8 +8603,7 @@
static PyObject *unicode_iter(PyObject *seq);
PyTypeObject PyUnicode_Type = {
- PyObject_HEAD_INIT(&PyType_Type)
- 0, /* ob_size */
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
"str", /* tp_name */
sizeof(PyUnicodeObject), /* tp_size */
0, /* tp_itemsize */
@@ -8902,8 +8900,7 @@
};
PyTypeObject PyUnicodeIter_Type = {
- PyObject_HEAD_INIT(&PyType_Type)
- 0, /* ob_size */
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
"unicodeiterator", /* tp_name */
sizeof(unicodeiterobject), /* tp_basicsize */
0, /* tp_itemsize */