Mercurial > cpython-lru_cache-weakref
diff Modules/_sqlite/sqlitecompat.h @ 59372:3003c1656e2a
Merged new pysqlite version 2.6.0 from trunk.
| author | Gerhard Häring <gh@ghaering.de> |
|---|---|
| date | Fri, 05 Mar 2010 15:20:03 +0000 |
| parents | f731859e9b3b |
| children | e9cd15d539e1 |
line wrap: on
line diff
--- a/Modules/_sqlite/sqlitecompat.h Fri Mar 05 15:17:26 2010 +0000 +++ b/Modules/_sqlite/sqlitecompat.h Fri Mar 05 15:20:03 2010 +0000 @@ -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 (*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
