annotate Modules/_sqlite/sqlitecompat.h @ 86913:8c9769b17171 3.2

Backout 7d399099334d.
author Georg Brandl <georg@python.org>
date Mon, 04 Nov 2013 07:44:29 +0100
parents e9cd15d539e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
1 /* sqlitecompat.h - compatibility macros
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
2 *
64423
e9cd15d539e1 Welcome to the UTF-8 world.
Florent Xicluna <florent.xicluna@gmail.com>
parents: 59372
diff changeset
3 * Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
4 *
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
5 * This file is part of pysqlite.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
6 *
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
7 * This software is provided 'as-is', without any express or implied
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
8 * warranty. In no event will the authors be held liable for any damages
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
9 * arising from the use of this software.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
10 *
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
11 * Permission is granted to anyone to use this software for any purpose,
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
12 * including commercial applications, and to alter it and redistribute it
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
13 * freely, subject to the following restrictions:
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
14 *
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
15 * 1. The origin of this software must not be misrepresented; you must not
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
16 * claim that you wrote the original software. If you use this software
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
17 * in a product, an acknowledgment in the product documentation would be
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
18 * appreciated but is not required.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
19 * 2. Altered source versions must be plainly marked as such, and must not be
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
20 * misrepresented as being the original software.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
21 * 3. This notice may not be removed or altered from any source distribution.
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
22 */
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
23
59372
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
24 #include "Python.h"
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
25
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
26 #ifndef PYSQLITE_COMPAT_H
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
27 #define PYSQLITE_COMPAT_H
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
28
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
29 /* define Py_ssize_t for pre-2.5 versions of Python */
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
30
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
31 #if PY_VERSION_HEX < 0x02050000
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
32 typedef int Py_ssize_t;
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
33 typedef int (*lenfunc)(PyObject*);
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
34 #endif
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
35
59372
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
36
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
37 /* define PyDict_CheckExact for pre-2.4 versions of Python */
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
38 #ifndef PyDict_CheckExact
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
39 #define PyDict_CheckExact(op) ((op)->ob_type == &PyDict_Type)
37879
f731859e9b3b Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff changeset
40 #endif
59372
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
41
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
42 /* define Py_CLEAR for pre-2.4 versions of Python */
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
43 #ifndef Py_CLEAR
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
44 #define Py_CLEAR(op) \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
45 do { \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
46 if (op) { \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
47 PyObject *tmp = (PyObject *)(op); \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
48 (op) = NULL; \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
49 Py_DECREF(tmp); \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
50 } \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
51 } while (0)
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
52 #endif
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
53
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
54 #ifndef PyVarObject_HEAD_INIT
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
55 #define PyVarObject_HEAD_INIT(type, size) \
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
56 PyObject_HEAD_INIT(type) size,
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
57 #endif
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
58
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
59 #ifndef Py_TYPE
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
60 #define Py_TYPE(ob) ((ob)->ob_type)
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
61 #endif
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
62
3003c1656e2a Merged new pysqlite version 2.6.0 from trunk.
Gerhard Häring <gh@ghaering.de>
parents: 37879
diff changeset
63 #endif