Mercurial > cpython-lru_cache-weakref
annotate Include/token.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 | 7e0e15d9957f |
| children |
| rev | line source |
|---|---|
| 145 | 1 |
| 6 | 2 /* Token types */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
65505
diff
changeset
|
3 #ifndef Py_LIMITED_API |
|
13445
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
4 #ifndef Py_TOKEN_H |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
5 #define Py_TOKEN_H |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
6 #ifdef __cplusplus |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
7 extern "C" { |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
8 #endif |
|
091ca6b9348f
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
9 |
|
65505
351d794d32f4
#4499: silence compiler warning on AIX.
R. David Murray <rdmurray@bitdance.com>
parents:
41230
diff
changeset
|
10 #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ |
|
351d794d32f4
#4499: silence compiler warning on AIX.
R. David Murray <rdmurray@bitdance.com>
parents:
41230
diff
changeset
|
11 |
| 6 | 12 #define ENDMARKER 0 |
| 13 #define NAME 1 | |
| 14 #define NUMBER 2 | |
| 15 #define STRING 3 | |
| 16 #define NEWLINE 4 | |
| 17 #define INDENT 5 | |
| 18 #define DEDENT 6 | |
| 19 #define LPAR 7 | |
| 20 #define RPAR 8 | |
| 21 #define LSQB 9 | |
| 22 #define RSQB 10 | |
| 23 #define COLON 11 | |
| 24 #define COMMA 12 | |
| 25 #define SEMI 13 | |
| 26 #define PLUS 14 | |
| 27 #define MINUS 15 | |
| 28 #define STAR 16 | |
| 29 #define SLASH 17 | |
| 30 #define VBAR 18 | |
| 31 #define AMPER 19 | |
| 32 #define LESS 20 | |
| 33 #define GREATER 21 | |
| 34 #define EQUAL 22 | |
| 35 #define DOT 23 | |
| 36 #define PERCENT 24 | |
|
74421
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
37 #define LBRACE 25 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
38 #define RBRACE 26 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
39 #define EQEQUAL 27 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
40 #define NOTEQUAL 28 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
41 #define LESSEQUAL 29 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
42 #define GREATEREQUAL 30 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
43 #define TILDE 31 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
44 #define CIRCUMFLEX 32 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
45 #define LEFTSHIFT 33 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
46 #define RIGHTSHIFT 34 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
47 #define DOUBLESTAR 35 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
48 #define PLUSEQUAL 36 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
49 #define MINEQUAL 37 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
50 #define STAREQUAL 38 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
51 #define SLASHEQUAL 39 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
52 #define PERCENTEQUAL 40 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
53 #define AMPEREQUAL 41 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
54 #define VBAREQUAL 42 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
55 #define CIRCUMFLEXEQUAL 43 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
56 #define LEFTSHIFTEQUAL 44 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
57 #define RIGHTSHIFTEQUAL 45 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
58 #define DOUBLESTAREQUAL 46 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
59 #define DOUBLESLASH 47 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
60 #define DOUBLESLASHEQUAL 48 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
61 #define AT 49 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
62 #define RARROW 50 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
63 #define ELLIPSIS 51 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
64 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ |
|
74421
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
65 #define OP 52 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
66 #define ERRORTOKEN 53 |
|
1c0c6fa7341c
Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
Meador Inge <meadori@gmail.com>
parents:
66664
diff
changeset
|
67 #define N_TOKENS 54 |
| 6 | 68 |
| 69 /* Special definitions for cooperation with parser */ | |
| 70 | |
| 71 #define NT_OFFSET 256 | |
| 72 | |
| 73 #define ISTERMINAL(x) ((x) < NT_OFFSET) | |
| 74 #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) | |
| 75 #define ISEOF(x) ((x) == ENDMARKER) | |
| 76 | |
| 77 | |
|
79925
7e0e15d9957f
make _PyParser_TokenNames const
Benjamin Peterson <benjamin@python.org>
parents:
74421
diff
changeset
|
78 PyAPI_DATA(const char *) _PyParser_TokenNames[]; /* Token names */ |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19051
diff
changeset
|
79 PyAPI_FUNC(int) PyToken_OneChar(int); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19051
diff
changeset
|
80 PyAPI_FUNC(int) PyToken_TwoChars(int, int); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
19051
diff
changeset
|
81 PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
82 |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
83 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
84 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
85 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
86 #endif /* !Py_TOKEN_H */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
65505
diff
changeset
|
87 #endif /* Py_LIMITED_API */ |
