Mercurial > cpython-lru_cache-weakref
annotate Include/structseq.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 | fc718c177ee6 |
| children |
| rev | line source |
|---|---|
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
| 63878 | 2 /* Named tuple object interface */ |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 #ifndef Py_STRUCTSEQ_H |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 #define Py_STRUCTSEQ_H |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 #ifdef __cplusplus |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 extern "C" { |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 #endif |
|
25824
1afb228e4265
Clean up some whitespace to be consistent with Python's C style.
Fred Drake <fdrake@acm.org>
parents:
25806
diff
changeset
|
9 |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 typedef struct PyStructSequence_Field { |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
11 char *name; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
12 char *doc; |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 } PyStructSequence_Field; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 typedef struct PyStructSequence_Desc { |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
16 char *name; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
17 char *doc; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
18 struct PyStructSequence_Field *fields; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
19 int n_in_sequence; |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 } PyStructSequence_Desc; |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 |
|
25806
0bbea4dcd9be
Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents:
24752
diff
changeset
|
22 extern char* PyStructSequence_UnnamedField; |
|
0bbea4dcd9be
Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents:
24752
diff
changeset
|
23 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
24 #ifndef Py_LIMITED_API |
|
25824
1afb228e4265
Clean up some whitespace to be consistent with Python's C style.
Fred Drake <fdrake@acm.org>
parents:
25806
diff
changeset
|
25 PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
42796
diff
changeset
|
26 PyStructSequence_Desc *desc); |
|
84793
fc718c177ee6
Issue #18520: Add a new PyStructSequence_InitType2() function, same than
Victor Stinner <victor.stinner@gmail.com>
parents:
66664
diff
changeset
|
27 PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, |
|
fc718c177ee6
Issue #18520: Add a new PyStructSequence_InitType2() function, same than
Victor Stinner <victor.stinner@gmail.com>
parents:
66664
diff
changeset
|
28 PyStructSequence_Desc *desc); |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
29 #endif |
|
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
30 PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); |
|
25824
1afb228e4265
Clean up some whitespace to be consistent with Python's C style.
Fred Drake <fdrake@acm.org>
parents:
25806
diff
changeset
|
31 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
20539
diff
changeset
|
32 PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
34 #ifndef Py_LIMITED_API |
|
62853
384f73a104e9
make struct sequences subclass tuple; kill lots of code
Benjamin Peterson <benjamin@python.org>
parents:
61466
diff
changeset
|
35 typedef PyTupleObject PyStructSequence; |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 /* Macro, *only* to be used to fill in brand new objects */ |
|
62853
384f73a104e9
make struct sequences subclass tuple; kill lots of code
Benjamin Peterson <benjamin@python.org>
parents:
61466
diff
changeset
|
38 #define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 |
|
62853
384f73a104e9
make struct sequences subclass tuple; kill lots of code
Benjamin Peterson <benjamin@python.org>
parents:
61466
diff
changeset
|
40 #define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
41 #endif |
|
42796
e1a36559d8b6
Remove PyArg_Parse usage from time module. (An extra set of eyeballs on
Skip Montanaro <skip@pobox.com>
parents:
25824
diff
changeset
|
42 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
43 PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); |
|
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
63878
diff
changeset
|
44 PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); |
|
42796
e1a36559d8b6
Remove PyArg_Parse usage from time module. (An extra set of eyeballs on
Skip Montanaro <skip@pobox.com>
parents:
25824
diff
changeset
|
45 |
|
20539
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 #ifdef __cplusplus |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 } |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 #endif |
|
2d599a36b67a
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 #endif /* !Py_STRUCTSEQ_H */ |
