Mercurial > cpython-lru_cache-weakref
annotate Include/funcobject.h @ 56121:ea697cde6882 3.1
Merged revisions 74881-74885,74888,74891-74895,74900,74905-74906,74931-74932,74934,74941-74942,74944,74956 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r74881 | r.david.murray | 2009-09-17 15:12:49 -0400 (Thu, 17 Sep 2009) | 2 lines
Check in first draft of maintainers.rst.
........
r74882 | eric.smith | 2009-09-17 15:22:30 -0400 (Thu, 17 Sep 2009) | 1 line
Typo.
........
r74883 | mark.dickinson | 2009-09-17 15:37:28 -0400 (Thu, 17 Sep 2009) | 1 line
Add some more module maintainers.
........
r74884 | mark.dickinson | 2009-09-17 15:39:12 -0400 (Thu, 17 Sep 2009) | 1 line
Revert accidental changes to Objects/longobject.c
........
r74885 | mark.dickinson | 2009-09-17 16:20:01 -0400 (Thu, 17 Sep 2009) | 1 line
Add decimal maintainers
........
r74888 | r.david.murray | 2009-09-17 18:10:48 -0400 (Thu, 17 Sep 2009) | 2 lines
Maintainer additions from MAL.
........
r74891 | georg.brandl | 2009-09-17 18:18:01 -0400 (Thu, 17 Sep 2009) | 1 line
Some more maintainers.
........
r74892 | r.david.murray | 2009-09-17 19:23:56 -0400 (Thu, 17 Sep 2009) | 2 lines
Add a couple interest areas for Nick per his request.
........
r74893 | r.david.murray | 2009-09-17 19:43:20 -0400 (Thu, 17 Sep 2009) | 2 lines
Benajmin is also compiler-knowledgeable.
........
r74894 | alexandre.vassalotti | 2009-09-17 20:59:05 -0400 (Thu, 17 Sep 2009) | 2 lines
Added myself to my areas of interest.
........
r74895 | brett.cannon | 2009-09-17 21:03:35 -0400 (Thu, 17 Sep 2009) | 1 line
Add myself to a couple places as maintainer.
........
r74900 | georg.brandl | 2009-09-18 05:06:37 -0400 (Fri, 18 Sep 2009) | 1 line
Add myself in interest areas.
........
r74905 | ezio.melotti | 2009-09-18 05:58:43 -0400 (Fri, 18 Sep 2009) | 1 line
Add myself in interest areas and mark effbot as inactive in winsound
........
r74906 | antoine.pitrou | 2009-09-18 09:15:23 -0400 (Fri, 18 Sep 2009) | 3 lines
Add myself in a couple of places
........
r74931 | r.david.murray | 2009-09-18 17:25:36 -0400 (Fri, 18 Sep 2009) | 5 lines
Add some names gleaned from the "Tracker Archeology" thread
on python-dev from back in February. Also consolidate
the autoconf and makefiles topics into one, and add tracker
and svn/hg topics.
........
r74932 | r.david.murray | 2009-09-18 17:32:16 -0400 (Fri, 18 Sep 2009) | 2 lines
Remove non-committer mistakenly added.
........
r74934 | r.david.murray | 2009-09-18 17:40:30 -0400 (Fri, 18 Sep 2009) | 2 lines
More descriptive/generic name for the svn/hg entry (version control)
........
r74941 | benjamin.peterson | 2009-09-18 18:45:59 -0400 (Fri, 18 Sep 2009) | 1 line
add a new category for myself
........
r74942 | benjamin.peterson | 2009-09-18 18:50:55 -0400 (Fri, 18 Sep 2009) | 1 line
add myself for symtable
........
r74944 | georg.brandl | 2009-09-19 03:39:05 -0400 (Sat, 19 Sep 2009) | 1 line
I would like to maintain the token module!
........
r74956 | r.david.murray | 2009-09-19 14:40:08 -0400 (Sat, 19 Sep 2009) | 3 lines
Add everyone who we know has been a release manager
as a resource for the 'release management' topic.
........
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Sat, 19 Sep 2009 19:04:37 +0000 |
| parents | 86a2679dca46 |
| children | 62b61abd02b8 |
| rev | line source |
|---|---|
| 145 | 1 |
| 6 | 2 /* Function object interface */ |
| 3 | |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
4 #ifndef Py_FUNCOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
5 #define Py_FUNCOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
6 #ifdef __cplusplus |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
7 extern "C" { |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
8 #endif |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
9 |
|
33856
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
10 /* Function objects and code objects should not be confused with each other: |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
11 * |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
12 * Function objects are created by the execution of the 'def' statement. |
| 42832 | 13 * They reference a code object in their __code__ attribute, which is a |
|
33856
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
14 * purely syntactic object, i.e. nothing more than a compiled version of some |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
15 * source code lines. There is one code object per source code "fragment", |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
16 * but each code object can be referenced by zero or many function objects |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
17 * depending only on how many times the 'def' statement in the source was |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
18 * executed so far. |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
19 */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
20 |
|
1288
9fed5726a36d
Several changes in one:
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
21 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
22 PyObject_HEAD |
| 42832 | 23 PyObject *func_code; /* A code object, the __code__ attribute */ |
|
33856
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
24 PyObject *func_globals; /* A dictionary (other mappings won't do) */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
25 PyObject *func_defaults; /* NULL or a tuple */ |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
33856
diff
changeset
|
26 PyObject *func_kwdefaults; /* NULL or a dict */ |
|
33856
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
27 PyObject *func_closure; /* NULL or a tuple of cell objects */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
28 PyObject *func_doc; /* The __doc__ attribute, can be anything */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
29 PyObject *func_name; /* The __name__ attribute, a string object */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
30 PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
31 PyObject *func_weakreflist; /* List of weak references */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
32 PyObject *func_module; /* The __module__ attribute, can be anything */ |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
33 PyObject *func_annotations; /* Annotations, a dict or NULL */ |
|
33856
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
34 |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
35 /* Invariant: |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
36 * func_closure contains the bindings for func_code->co_freevars, so |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
37 * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
38 * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
27559
diff
changeset
|
39 */ |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2073
diff
changeset
|
40 } PyFunctionObject; |
|
1288
9fed5726a36d
Several changes in one:
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
41 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
42 PyAPI_DATA(PyTypeObject) PyFunction_Type; |
| 6 | 43 |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
42832
diff
changeset
|
44 #define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) |
| 6 | 45 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
46 PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
47 PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
48 PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
24752
diff
changeset
|
49 PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
50 PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
51 PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
33856
diff
changeset
|
52 PyAPI_FUNC(PyObject *) PyFunction_GetKwDefaults(PyObject *); |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
33856
diff
changeset
|
53 PyAPI_FUNC(int) PyFunction_SetKwDefaults(PyObject *, PyObject *); |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
54 PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
55 PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
56 PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
57 PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
58 |
|
8658
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
59 /* Macros for direct access to these values. Type checks are *not* |
|
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
60 done, so use with care. */ |
|
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
61 #define PyFunction_GET_CODE(func) \ |
|
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
62 (((PyFunctionObject *)func) -> func_code) |
|
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
63 #define PyFunction_GET_GLOBALS(func) \ |
|
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
64 (((PyFunctionObject *)func) -> func_globals) |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
24752
diff
changeset
|
65 #define PyFunction_GET_MODULE(func) \ |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
24752
diff
changeset
|
66 (((PyFunctionObject *)func) -> func_module) |
|
8658
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
67 #define PyFunction_GET_DEFAULTS(func) \ |
|
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
68 (((PyFunctionObject *)func) -> func_defaults) |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
33856
diff
changeset
|
69 #define PyFunction_GET_KW_DEFAULTS(func) \ |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
33856
diff
changeset
|
70 (((PyFunctionObject *)func) -> func_kwdefaults) |
|
16257
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15894
diff
changeset
|
71 #define PyFunction_GET_CLOSURE(func) \ |
|
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15894
diff
changeset
|
72 (((PyFunctionObject *)func) -> func_closure) |
|
40529
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
73 #define PyFunction_GET_ANNOTATIONS(func) \ |
|
54cd47788811
PEP 3107 - Function Annotations thanks to Tony Lownds
Neal Norwitz <nnorwitz@gmail.com>
parents:
40215
diff
changeset
|
74 (((PyFunctionObject *)func) -> func_annotations) |
|
8658
1e93fa021405
Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
75 |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
17169
diff
changeset
|
76 /* The classmethod and staticmethod types lives here, too */ |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
77 PyAPI_DATA(PyTypeObject) PyClassMethod_Type; |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
78 PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
17169
diff
changeset
|
79 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
80 PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
18933
diff
changeset
|
81 PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
17169
diff
changeset
|
82 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
83 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
84 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
85 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
86 #endif /* !Py_FUNCOBJECT_H */ |
