annotate Include/compile.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 5fe72b9ed48e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
1 #ifndef Py_COMPILE_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
2 #define Py_COMPILE_H
36745
3ffc1e1d2f57 Move #include to outside "extern C {}", before Tim figures out it'll break
Thomas Wouters <thomas@python.org>
parents: 36740
diff changeset
3
72511
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
4 #ifndef Py_LIMITED_API
36745
3ffc1e1d2f57 Move #include to outside "extern C {}", before Tim figures out it'll break
Thomas Wouters <thomas@python.org>
parents: 36740
diff changeset
5 #include "code.h"
3ffc1e1d2f57 Move #include to outside "extern C {}", before Tim figures out it'll break
Thomas Wouters <thomas@python.org>
parents: 36740
diff changeset
6
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
7 #ifdef __cplusplus
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
8 extern "C" {
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
9 #endif
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
10
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 /* Public interface */
161
25a7fb44e297 Satisfy Standard C rules about struct scope.
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
12 struct _node; /* Declare the existence of this type */
26601
cc05c2c8660e Constify filenames and scripts. Fixes #651362.
Martin v. Löwis <martin@v.loewis.de>
parents: 24752
diff changeset
13 PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
14
16799
08d937107fe6 Improved __future__ parser; still more to do
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16781
diff changeset
15 /* Future feature support */
08d937107fe6 Improved __future__ parser; still more to do
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16781
diff changeset
16
08d937107fe6 Improved __future__ parser; still more to do
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16781
diff changeset
17 typedef struct {
35742
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 31514
diff changeset
18 int ff_features; /* flags set by future statements */
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 31514
diff changeset
19 int ff_lineno; /* line number of last future statement */
16799
08d937107fe6 Improved __future__ parser; still more to do
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16781
diff changeset
20 } PyFutureFeatures;
08d937107fe6 Improved __future__ parser; still more to do
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16781
diff changeset
21
08d937107fe6 Improved __future__ parser; still more to do
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16781
diff changeset
22 #define FUTURE_NESTED_SCOPES "nested_scopes"
18609
59446d0f8341 Preliminary support for "from __future__ import generators" to enable
Guido van Rossum <guido@python.org>
parents: 18506
diff changeset
23 #define FUTURE_GENERATORS "generators"
19051
f20727cc3d0f Implement PEP 238 in its (almost) full glory.
Guido van Rossum <guido@python.org>
parents: 18611
diff changeset
24 #define FUTURE_DIVISION "division"
37418
cea54c9d921d Don't abbreviate ABS, use long name ABSOLUTE.
Neal Norwitz <nnorwitz@gmail.com>
parents: 36745
diff changeset
25 #define FUTURE_ABSOLUTE_IMPORT "absolute_import"
36726
bbf16fd024df from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents: 36712
diff changeset
26 #define FUTURE_WITH_STATEMENT "with_statement"
45965
91ac8049e709 Add __future__ import for print_function. It's a no-op in 3.0, but it needs to not be a syntax error.
Eric Smith <eric@trueblade.com>
parents: 37418
diff changeset
27 #define FUTURE_PRINT_FUNCTION "print_function"
46120
78504d604b44 Merged revisions 61952-61953 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents: 45965
diff changeset
28 #define FUTURE_UNICODE_LITERALS "unicode_literals"
52641
0530aadff696 The BDFL has retired! Long live the FLUFL (Friendly Language Uncle For Life)!
Brett Cannon <bcannon@gmail.com>
parents: 49633
diff changeset
29 #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
19051
f20727cc3d0f Implement PEP 238 in its (almost) full glory.
Guido van Rossum <guido@python.org>
parents: 18611
diff changeset
30
35742
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 31514
diff changeset
31 struct _mod; /* Declare the existence of this type */
66685
713c6b6ca5ce Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.
Georg Brandl <georg@python.org>
parents: 66664
diff changeset
32 #define PyAST_Compile(mod, s, f, ar) PyAST_CompileEx(mod, s, f, -1, ar)
67151
66d8446a019b Issue #9738: Document encodings of AST, compiler, parser and PyRun functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66685
diff changeset
33 PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(
67152
f61196453c78 Issue #9738: Ooops, fix typos in my previous commit (r87506)
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67151
diff changeset
34 struct _mod *mod,
67151
66d8446a019b Issue #9738: Document encodings of AST, compiler, parser and PyRun functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66685
diff changeset
35 const char *filename, /* decoded from the filesystem encoding */
66d8446a019b Issue #9738: Document encodings of AST, compiler, parser and PyRun functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66685
diff changeset
36 PyCompilerFlags *flags,
66d8446a019b Issue #9738: Document encodings of AST, compiler, parser and PyRun functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66685
diff changeset
37 int optimize,
66d8446a019b Issue #9738: Document encodings of AST, compiler, parser and PyRun functions
Victor Stinner <victor.stinner@haypocalc.com>
parents: 66685
diff changeset
38 PyArena *arena);
85417
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
39 PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject(
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
40 struct _mod *mod,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
41 PyObject *filename,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
42 PyCompilerFlags *flags,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
43 int optimize,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
44 PyArena *arena);
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
45 PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
46 struct _mod * mod,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
47 const char *filename /* decoded from the filesystem encoding */
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
48 );
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
49 PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromASTObject(
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
50 struct _mod * mod,
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
51 PyObject *filename
df2fdd42b375 Close #11619: The parser and the import machinery do not encode Unicode
Victor Stinner <victor.stinner@gmail.com>
parents: 72511
diff changeset
52 );
35742
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 31514
diff changeset
53
72511
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
54 /* _Py_Mangle is defined in compile.c */
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
55 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
35742
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 31514
diff changeset
56
87465
5fe72b9ed48e Issue #19722: Added opcode.stack_effect(), which accurately
Larry Hastings <larry@hastings.org>
parents: 85417
diff changeset
57 #define PY_INVALID_STACK_EFFECT INT_MAX
5fe72b9ed48e Issue #19722: Added opcode.stack_effect(), which accurately
Larry Hastings <larry@hastings.org>
parents: 85417
diff changeset
58 PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
5fe72b9ed48e Issue #19722: Added opcode.stack_effect(), which accurately
Larry Hastings <larry@hastings.org>
parents: 85417
diff changeset
59
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
60 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
61 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
62 #endif
72511
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
63
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
64 #endif /* !Py_LIMITED_API */
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
65
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
66 /* These definitions must match corresponding definitions in graminit.h.
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
67 There's code in compile.c that checks that they are the same. */
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
68 #define Py_single_input 256
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
69 #define Py_file_input 257
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
70 #define Py_eval_input 258
775977c601cd Move code related to compile from Python.h to compile.h
Victor Stinner <victor.stinner@haypocalc.com>
parents: 67152
diff changeset
71
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
72 #endif /* !Py_COMPILE_H */