Mercurial > cpython-lru_cache-weakref
annotate Modules/_sqlite/statement.h @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | 0fc10a33eb4c |
| children |
| 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 /* statement.h - definitions for the statement type |
|
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) 2005-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 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
24 #ifndef PYSQLITE_STATEMENT_H |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
25 #define PYSQLITE_STATEMENT_H |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
26 #include "Python.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 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
28 #include "connection.h" |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
29 #include "sqlite3.h" |
|
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 #define PYSQLITE_TOO_MUCH_SQL (-100) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
32 #define PYSQLITE_SQL_WRONG_TYPE (-101) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
33 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
34 typedef struct |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
35 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
36 PyObject_HEAD |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
37 sqlite3* db; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
38 sqlite3_stmt* st; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
39 PyObject* sql; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
40 int in_use; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
41 PyObject* in_weakreflist; /* List of weak references */ |
|
40643
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
42 } pysqlite_Statement; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
43 |
|
40643
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
44 extern PyTypeObject pysqlite_StatementType; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
45 |
|
40643
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
46 int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* connection, PyObject* sql); |
|
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
47 void pysqlite_statement_dealloc(pysqlite_Statement* self); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
48 |
|
74850
0fc10a33eb4c
Undocument and clean up sqlite3.OptimizedUnicode
Petri Lehtinen <petri@digip.org>
parents:
64423
diff
changeset
|
49 int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter); |
|
0fc10a33eb4c
Undocument and clean up sqlite3.OptimizedUnicode
Petri Lehtinen <petri@digip.org>
parents:
64423
diff
changeset
|
50 void pysqlite_statement_bind_parameters(pysqlite_Statement* self, PyObject* parameters); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
51 |
|
40643
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
52 int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* parameters); |
|
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
53 int pysqlite_statement_finalize(pysqlite_Statement* self); |
|
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
54 int pysqlite_statement_reset(pysqlite_Statement* self); |
|
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
55 void pysqlite_statement_mark_dirty(pysqlite_Statement* self); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
56 |
|
40643
47f9efdc0855
Merged revisions 53304-53433,53435-53450 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
57 int pysqlite_statement_setup_types(void); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
58 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
59 #endif |
