annotate Include/funcobject.h @ 20737:00a581bdedeb legacy-trunk

When overriding __str__ or __repr__, set the tp_print slot to NULL.
author Guido van Rossum <guido@python.org>
date Mon, 29 Oct 2001 14:33:44 +0000
parents 09df3254b49d
children c1eb668525e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 85
diff changeset
1
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Function object interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
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
1288
9fed5726a36d Several changes in one:
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
10 typedef struct {
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
11 PyObject_HEAD
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
12 PyObject *func_code;
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
13 PyObject *func_globals;
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
14 PyObject *func_defaults;
16257
fd8c7203251f PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 15894
diff changeset
15 PyObject *func_closure;
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
16 PyObject *func_doc;
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
17 PyObject *func_name;
15894
1c6b0d3a58ea Committing PEP 232, function attribute feature, approved by Guido.
Barry Warsaw <barry@python.org>
parents: 14375
diff changeset
18 PyObject *func_dict;
17169
d807488dfc7a Add the necessary field for weak reference support to the function and
Fred Drake <fdrake@acm.org>
parents: 16257
diff changeset
19 PyObject *func_weakreflist;
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2073
diff changeset
20 } PyFunctionObject;
1288
9fed5726a36d Several changes in one:
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
21
2436
fa98dda07877 make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents: 2146
diff changeset
22 extern DL_IMPORT(PyTypeObject) PyFunction_Type;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
23
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2073
diff changeset
24 #define PyFunction_Check(op) ((op)->ob_type == &PyFunction_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
25
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
26 extern DL_IMPORT(PyObject *) PyFunction_New(PyObject *, PyObject *);
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
27 extern DL_IMPORT(PyObject *) PyFunction_GetCode(PyObject *);
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
28 extern DL_IMPORT(PyObject *) PyFunction_GetGlobals(PyObject *);
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
29 extern DL_IMPORT(PyObject *) PyFunction_GetDefaults(PyObject *);
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
30 extern DL_IMPORT(int) PyFunction_SetDefaults(PyObject *, PyObject *);
16257
fd8c7203251f PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 15894
diff changeset
31 extern DL_IMPORT(PyObject *) PyFunction_GetClosure(PyObject *);
fd8c7203251f PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 15894
diff changeset
32 extern DL_IMPORT(int) PyFunction_SetClosure(PyObject *, PyObject *);
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
33
8658
1e93fa021405 Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
34 /* 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
35 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
36 #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
37 (((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
38 #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
39 (((PyFunctionObject *)func) -> func_globals)
1e93fa021405 Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
40 #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
41 (((PyFunctionObject *)func) -> func_defaults)
16257
fd8c7203251f PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 15894
diff changeset
42 #define PyFunction_GET_CLOSURE(func) \
fd8c7203251f PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 15894
diff changeset
43 (((PyFunctionObject *)func) -> func_closure)
8658
1e93fa021405 Add macros for direct access to the members of CFunction objects.
Guido van Rossum <guido@python.org>
parents: 4503
diff changeset
44
18933
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
45 /* The classmethod and staticmethod types lives here, too */
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
46 extern DL_IMPORT(PyTypeObject) PyClassMethod_Type;
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
47 extern DL_IMPORT(PyTypeObject) PyStaticMethod_Type;
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
48
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
49 extern DL_IMPORT(PyObject *) PyClassMethod_New(PyObject *);
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
50 extern DL_IMPORT(PyObject *) PyStaticMethod_New(PyObject *);
09df3254b49d Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents: 17169
diff changeset
51
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
52 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
53 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
54 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1288
diff changeset
55 #endif /* !Py_FUNCOBJECT_H */