Mercurial > cpython-lru_cache-weakref
annotate Include/methodobject.h @ 84007:dbfbdf2b5c19 3.3
Fix #17967: For ftp urls CWD to target instead of hopping to each directory
towards target. This fixes a bug where target is accessible, but parent
directories are restricted.
| author | Senthil Kumaran <senthil@uthcode.com> |
|---|---|
| date | Sat, 01 Jun 2013 08:27:06 -0700 |
| parents | d63a80abfbec |
| children | 3a86a3f1d89a |
| rev | line source |
|---|---|
| 145 | 1 |
| 6 | 2 /* Method object interface */ |
| 3 | |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
4 #ifndef Py_METHODOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
5 #define Py_METHODOBJECT_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:
31172
diff
changeset
|
10 /* This is about the type 'builtin_function_or_method', |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
31172
diff
changeset
|
11 not Python methods in user-defined classes. See classobject.h |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
31172
diff
changeset
|
12 for the latter. */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
31172
diff
changeset
|
13 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22613
diff
changeset
|
14 PyAPI_DATA(PyTypeObject) PyCFunction_Type; |
| 6 | 15 |
|
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:
43177
diff
changeset
|
16 #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) |
| 6 | 17 |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
13444
diff
changeset
|
18 typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); |
|
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
13444
diff
changeset
|
19 typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, |
|
76112
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
20 PyObject *); |
|
19198
3c1c9948ff65
Remove much dead code from ceval.c
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
14375
diff
changeset
|
21 typedef PyObject *(*PyNoArgsFunction)(PyObject *); |
| 6 | 22 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22613
diff
changeset
|
23 PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22613
diff
changeset
|
24 PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22613
diff
changeset
|
25 PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); |
| 86 | 26 |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
27 /* Macros for direct access to these values. Type checks are *not* |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
28 done, so use with care. */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
48418
diff
changeset
|
29 #ifndef Py_LIMITED_API |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
30 #define PyCFunction_GET_FUNCTION(func) \ |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
31 (((PyCFunctionObject *)func) -> m_ml -> ml_meth) |
|
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
32 #define PyCFunction_GET_SELF(func) \ |
|
74141
7a7b698f6f21
Issue #13577: Built-in methods and functions now have a __qualname__.
Antoine Pitrou <solipsis@pitrou.net>
parents:
66664
diff
changeset
|
33 (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \ |
|
7a7b698f6f21
Issue #13577: Built-in methods and functions now have a __qualname__.
Antoine Pitrou <solipsis@pitrou.net>
parents:
66664
diff
changeset
|
34 NULL : ((PyCFunctionObject *)func) -> m_self) |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
35 #define PyCFunction_GET_FLAGS(func) \ |
|
76112
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
36 (((PyCFunctionObject *)func) -> m_ml -> ml_flags) |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
48418
diff
changeset
|
37 #endif |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
22613
diff
changeset
|
38 PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
39 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2072
diff
changeset
|
40 struct PyMethodDef { |
|
76112
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
41 const char *ml_name; /* The name of the built-in function/method */ |
|
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
42 PyCFunction ml_meth; /* The C function that implements it */ |
|
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
43 int ml_flags; /* Combination of METH_xxx flags, which mostly |
|
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
44 describe the args expected by the C func */ |
|
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
45 const char *ml_doc; /* The __doc__ attribute, or NULL */ |
| 86 | 46 }; |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2072
diff
changeset
|
47 typedef struct PyMethodDef PyMethodDef; |
| 86 | 48 |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
24752
diff
changeset
|
49 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
24752
diff
changeset
|
50 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, |
|
76112
64b8fdb0bfa9
Reformat by replacing tabs with 4-spaces. Makes the code more PEP-7 compliant
Eli Bendersky <eliben@gmail.com>
parents:
74141
diff
changeset
|
51 PyObject *); |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
52 |
| 2058 | 53 /* Flag passed to newmethodobject */ |
| 43177 | 54 /* #define METH_OLDARGS 0x0000 -- unsupported now */ |
| 2058 | 55 #define METH_VARARGS 0x0001 |
|
2863
10e007aef1cf
changes for keyword args to built-in functions and classes
Guido van Rossum <guido@python.org>
parents:
2436
diff
changeset
|
56 #define METH_KEYWORDS 0x0002 |
|
22613
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
57 /* METH_NOARGS and METH_O must not be combined with the flags above. */ |
|
19198
3c1c9948ff65
Remove much dead code from ceval.c
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
14375
diff
changeset
|
58 #define METH_NOARGS 0x0004 |
|
3c1c9948ff65
Remove much dead code from ceval.c
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
14375
diff
changeset
|
59 #define METH_O 0x0008 |
| 2058 | 60 |
|
22613
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
61 /* METH_CLASS and METH_STATIC are a little different; these control |
|
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
62 the construction of methods for a class. These cannot be used for |
|
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
63 functions in modules. */ |
|
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
64 #define METH_CLASS 0x0010 |
|
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
65 #define METH_STATIC 0x0020 |
|
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19198
diff
changeset
|
66 |
|
39536
8f5b9982beba
Completely get rid of PyClass and PyInstance.
Guido van Rossum <guido@python.org>
parents:
35999
diff
changeset
|
67 /* METH_COEXIST allows a method to be entered even though a slot has |
|
31172
e4fb6164158c
* Added a new method flag, METH_COEXIST.
Raymond Hettinger <python@rcn.com>
parents:
27559
diff
changeset
|
68 already filled the entry. When defined, the flag allows a separate |
|
e4fb6164158c
* Added a new method flag, METH_COEXIST.
Raymond Hettinger <python@rcn.com>
parents:
27559
diff
changeset
|
69 method, "__contains__" for example, to coexist with a defined |
|
e4fb6164158c
* Added a new method flag, METH_COEXIST.
Raymond Hettinger <python@rcn.com>
parents:
27559
diff
changeset
|
70 slot like sq_contains. */ |
|
e4fb6164158c
* Added a new method flag, METH_COEXIST.
Raymond Hettinger <python@rcn.com>
parents:
27559
diff
changeset
|
71 |
|
e4fb6164158c
* Added a new method flag, METH_COEXIST.
Raymond Hettinger <python@rcn.com>
parents:
27559
diff
changeset
|
72 #define METH_COEXIST 0x0040 |
|
e4fb6164158c
* Added a new method flag, METH_COEXIST.
Raymond Hettinger <python@rcn.com>
parents:
27559
diff
changeset
|
73 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
48418
diff
changeset
|
74 #ifndef Py_LIMITED_API |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
75 typedef struct { |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
76 PyObject_HEAD |
|
33856
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
31172
diff
changeset
|
77 PyMethodDef *m_ml; /* Description of the C function to call */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
31172
diff
changeset
|
78 PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ |
|
60c60dc75c77
Wrote down the invariants of some common objects whose structure is
Armin Rigo <arigo@tunes.org>
parents:
31172
diff
changeset
|
79 PyObject *m_module; /* The __module__ attribute, can be anything */ |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
80 } PyCFunctionObject; |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
48418
diff
changeset
|
81 #endif |
|
8656
9e536dd3dc97
Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
82 |
|
45371
7c4c46342137
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60845 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
83 PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); |
|
7c4c46342137
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60845 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
84 |
|
77577
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
76112
diff
changeset
|
85 #ifndef Py_LIMITED_API |
|
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
76112
diff
changeset
|
86 PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out); |
|
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
76112
diff
changeset
|
87 PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out); |
|
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
76112
diff
changeset
|
88 #endif |
|
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
76112
diff
changeset
|
89 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
90 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
91 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
92 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
93 #endif /* !Py_METHODOBJECT_H */ |
