summaryrefslogtreecommitdiffstats
path: root/Modules/_bsddb.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 /Modules/_bsddb.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 'Modules/_bsddb.c')
-rw-r--r--Modules/_bsddb.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index e71169c..0347907 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -300,13 +300,13 @@ staticforward PyTypeObject DBSequence_Type;
staticforward PyTypeObject DB_Type, DBCursor_Type, DBEnv_Type, DBTxn_Type, DBLock_Type;
-#define DBObject_Check(v) ((v)->ob_type == &DB_Type)
-#define DBCursorObject_Check(v) ((v)->ob_type == &DBCursor_Type)
-#define DBEnvObject_Check(v) ((v)->ob_type == &DBEnv_Type)
-#define DBTxnObject_Check(v) ((v)->ob_type == &DBTxn_Type)
-#define DBLockObject_Check(v) ((v)->ob_type == &DBLock_Type)
+#define DBObject_Check(v) (Py_Type(v) == &DB_Type)
+#define DBCursorObject_Check(v) (Py_Type(v) == &DBCursor_Type)
+#define DBEnvObject_Check(v) (Py_Type(v) == &DBEnv_Type)
+#define DBTxnObject_Check(v) (Py_Type(v) == &DBTxn_Type)
+#define DBLockObject_Check(v) (Py_Type(v) == &DBLock_Type)
#if (DBVER >= 43)
-#define DBSequenceObject_Check(v) ((v)->ob_type == &DBSequence_Type)
+#define DBSequenceObject_Check(v) (Py_Type(v) == &DBSequence_Type)
#endif
@@ -461,7 +461,7 @@ make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags)
else {
PyErr_Format(PyExc_TypeError,
"String or Integer object expected for key, %s found",
- keyobj->ob_type->tp_name);
+ Py_Type(keyobj)->tp_name);
return 0;
}
@@ -616,7 +616,7 @@ static int makeDBError(int err)
static void makeTypeError(char* expected, PyObject* found)
{
PyErr_Format(PyExc_TypeError, "Expected %s argument, %s found.",
- expected, found->ob_type->tp_name);
+ expected, Py_Type(found)->tp_name);
}
@@ -5666,13 +5666,13 @@ DL_EXPORT(void) init_bsddb(void)
/* Initialize the type of the new type objects here; doing it here
is required for portability to Windows without requiring C++. */
- DB_Type.ob_type = &PyType_Type;
- DBCursor_Type.ob_type = &PyType_Type;
- DBEnv_Type.ob_type = &PyType_Type;
- DBTxn_Type.ob_type = &PyType_Type;
- DBLock_Type.ob_type = &PyType_Type;
+ Py_Type(&DB_Type) = &PyType_Type;
+ Py_Type(&DBCursor_Type) = &PyType_Type;
+ Py_Type(&DBEnv_Type) = &PyType_Type;
+ Py_Type(&DBTxn_Type) = &PyType_Type;
+ Py_Type(&DBLock_Type) = &PyType_Type;
#if (DBVER >= 43)
- DBSequence_Type.ob_type = &PyType_Type;
+ Py_Type(&DBSequence_Type) = &PyType_Type;
#endif