summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/sqlitecompat.h
diff options
context:
space:
mode:
authorGerhard Häring <gh@ghaering.de>2010-03-05 15:20:03 (GMT)
committerGerhard Häring <gh@ghaering.de>2010-03-05 15:20:03 (GMT)
commitf9cee224461273307ca9f8a0e690a527496534ab (patch)
treec12745138703eba02cc59f892cf9f19db6cd7ff5 /Modules/_sqlite/sqlitecompat.h
parent06dbff3b1f16dc232df0190cfed4b3af81aecda3 (diff)
downloadcpython-f9cee224461273307ca9f8a0e690a527496534ab.zip
cpython-f9cee224461273307ca9f8a0e690a527496534ab.tar.gz
cpython-f9cee224461273307ca9f8a0e690a527496534ab.tar.bz2
Merged new pysqlite version 2.6.0 from trunk.
Diffstat (limited to 'Modules/_sqlite/sqlitecompat.h')
-rw-r--r--Modules/_sqlite/sqlitecompat.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/Modules/_sqlite/sqlitecompat.h b/Modules/_sqlite/sqlitecompat.h
index c379825..3408fc2 100644
--- a/Modules/_sqlite/sqlitecompat.h
+++ b/Modules/_sqlite/sqlitecompat.h
@@ -1,6 +1,6 @@
/* sqlitecompat.h - compatibility macros
*
- * Copyright (C) 2006 Gerhard Häring <gh@ghaering.de>
+ * Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
*
* This file is part of pysqlite.
*
@@ -21,6 +21,8 @@
* 3. This notice may not be removed or altered from any source distribution.
*/
+#include "Python.h"
+
#ifndef PYSQLITE_COMPAT_H
#define PYSQLITE_COMPAT_H
@@ -31,4 +33,31 @@ typedef int Py_ssize_t;
typedef int (*lenfunc)(PyObject*);
#endif
+
+/* define PyDict_CheckExact for pre-2.4 versions of Python */
+#ifndef PyDict_CheckExact
+#define PyDict_CheckExact(op) ((op)->ob_type == &PyDict_Type)
+#endif
+
+/* define Py_CLEAR for pre-2.4 versions of Python */
+#ifndef Py_CLEAR
+#define Py_CLEAR(op) \
+ do { \
+ if (op) { \
+ PyObject *tmp = (PyObject *)(op); \
+ (op) = NULL; \
+ Py_DECREF(tmp); \
+ } \
+ } while (0)
+#endif
+
+#ifndef PyVarObject_HEAD_INIT
+#define PyVarObject_HEAD_INIT(type, size) \
+ PyObject_HEAD_INIT(type) size,
+#endif
+
+#ifndef Py_TYPE
+#define Py_TYPE(ob) ((ob)->ob_type)
+#endif
+
#endif