summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-07-27 21:53:35 (GMT)
committerGuido van Rossum <guido@python.org>2006-07-27 21:53:35 (GMT)
commit3cf5b1eef99fbd85bbd2bcd2e6223dfec92daf8b (patch)
tree310222781e7a80027e813b9e61b9b412fecc9a87 /Modules
parent73e5a5b65d66f4fba9c4f626bcd6400f4a7215e6 (diff)
downloadcpython-3cf5b1eef99fbd85bbd2bcd2e6223dfec92daf8b.zip
cpython-3cf5b1eef99fbd85bbd2bcd2e6223dfec92daf8b.tar.gz
cpython-3cf5b1eef99fbd85bbd2bcd2e6223dfec92daf8b.tar.bz2
Get rid of most of the flags (in tp_flags) that keep track of various
variations of the type struct and its attachments. In Py3k, all type structs have to have all fields -- no binary backwards compatibility. Had to change the complex object to a new-style number!
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bsddb.c12
-rw-r--r--Modules/_ctypes/stgdict.c2
-rw-r--r--Modules/_functoolsmodule.c2
-rw-r--r--Modules/_sqlite/cursor.c2
-rw-r--r--Modules/_sqlite/statement.c2
-rw-r--r--Modules/_sre.c2
-rw-r--r--Modules/_struct.c2
-rw-r--r--Modules/arraymodule.c8
-rw-r--r--Modules/collectionsmodule.c8
-rw-r--r--Modules/datetimemodule.c15
-rw-r--r--Modules/mmapmodule.c6
11 files changed, 25 insertions, 36 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index a640d52..9220866 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -5350,7 +5350,7 @@ static PyTypeObject DB_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -5383,7 +5383,7 @@ static PyTypeObject DBCursor_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -5416,7 +5416,7 @@ static PyTypeObject DBEnv_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -5448,7 +5448,7 @@ static PyTypeObject DBTxn_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -5481,7 +5481,7 @@ static PyTypeObject DBLock_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -5514,7 +5514,7 @@ static PyTypeObject DBSequence_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 336be37..c1c30f1 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -128,8 +128,6 @@ PyType_stgdict(PyObject *obj)
if (!PyType_Check(obj))
return NULL;
type = (PyTypeObject *)obj;
- if (!PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS))
- return NULL;
if (!type->tp_dict || !StgDict_Check(type->tp_dict))
return NULL;
return (StgDictObject *)type->tp_dict;
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 54abb89..7b23210 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -219,7 +219,7 @@ static PyTypeObject partial_type = {
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
- Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_BASETYPE, /* tp_flags */
partial_doc, /* tp_doc */
(traverseproc)partial_traverse, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 6ee8bea..95a4931 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -998,7 +998,7 @@ PyTypeObject CursorType = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_ITER|Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
cursor_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 55923e7..4e45636 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -403,7 +403,7 @@ PyTypeObject StatementType = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 42e0c20..d4e6051 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2628,7 +2628,7 @@ static PyTypeObject Pattern_Type = {
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
pattern_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 3a44bde..df243ec 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1706,7 +1706,7 @@ PyTypeObject PyStructType = {
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS,/* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
s__doc__, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index af12769..100b341 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1570,13 +1570,11 @@ array_repr(arrayobject *a)
return s;
}
-#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX)
-
static PyObject*
array_subscr(arrayobject* self, PyObject* item)
{
PyNumberMethods *nb = item->ob_type->tp_as_number;
- if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) {
+ if (nb != NULL && nb->nb_index != NULL) {
Py_ssize_t i = nb->nb_index(item);
if (i==-1 && PyErr_Occurred()) {
return NULL;
@@ -1626,7 +1624,7 @@ static int
array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
{
PyNumberMethods *nb = item->ob_type->tp_as_number;
- if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) {
+ if (nb != NULL && nb->nb_index != NULL) {
Py_ssize_t i = nb->nb_index(item);
if (i==-1 && PyErr_Occurred())
return -1;
@@ -1984,7 +1982,7 @@ static PyTypeObject Arraytype = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
&array_as_buffer, /* tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
arraytype_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/collectionsmodule.c b/Modules/collectionsmodule.c
index c7e2c85..0c7dca6 100644
--- a/Modules/collectionsmodule.c
+++ b/Modules/collectionsmodule.c
@@ -846,8 +846,8 @@ static PyTypeObject deque_type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
- Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+ Py_TPFLAGS_HAVE_GC, /* tp_flags */
deque_doc, /* tp_doc */
(traverseproc)deque_traverse, /* tp_traverse */
(inquiry)deque_clear, /* tp_clear */
@@ -1299,8 +1299,8 @@ static PyTypeObject defdict_type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
- Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+ Py_TPFLAGS_HAVE_GC, /* tp_flags */
defdict_doc, /* tp_doc */
defdict_traverse, /* tp_traverse */
(inquiry)defdict_tp_clear, /* tp_clear */
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 760ab31..5dcd6a4 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -2141,8 +2141,7 @@ static PyTypeObject PyDateTime_DeltaType = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
delta_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -2698,8 +2697,7 @@ static PyTypeObject PyDateTime_DateType = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
date_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -2954,8 +2952,7 @@ static PyTypeObject PyDateTime_TZInfoType = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
tzinfo_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -3473,8 +3470,7 @@ static PyTypeObject PyDateTime_TimeType = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
time_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
@@ -4568,8 +4564,7 @@ static PyTypeObject PyDateTime_DateTimeType = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
datetime_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 19970c9..d7a8944 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -800,13 +800,11 @@ static PyTypeObject mmap_object_type = {
0, /*tp_getattro*/
0, /*tp_setattro*/
&mmap_as_buffer, /*tp_as_buffer*/
- Py_TPFLAGS_HAVE_GETCHARBUFFER, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
};
-#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX)
-
/* extract the map size from the given PyObject
Returns -1 on error, with an appropriate Python exception raised. On
@@ -815,7 +813,7 @@ static Py_ssize_t
_GetMapSize(PyObject *o)
{
PyNumberMethods *nb = o->ob_type->tp_as_number;
- if (nb != NULL && HASINDEX(o) && nb->nb_index != NULL) {
+ if (nb != NULL && nb->nb_index != NULL) {
Py_ssize_t i = nb->nb_index(o);
if (i==-1 && PyErr_Occurred())
return -1;