Mercurial > cpython-lru_cache-weakref
annotate Include/code.h @ 58664:993f703a61ba
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
Fix-up ftplib documentation:
move exception descriptions to toplevel, not inside a class
remove attribution in "versionadded"
spell and grammar check docstring of FTP_TLS
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Wed, 03 Feb 2010 02:35:45 +0000 |
| parents | 79718ee03986 |
| children | eea72b81a23c |
| rev | line source |
|---|---|
| 35742 | 1 /* Definitions for bytecode */ |
| 2 | |
| 3 #ifndef Py_CODE_H | |
| 4 #define Py_CODE_H | |
| 5 #ifdef __cplusplus | |
| 6 extern "C" { | |
| 7 #endif | |
| 8 | |
| 9 /* Bytecode object */ | |
| 10 typedef struct { | |
| 11 PyObject_HEAD | |
| 12 int co_argcount; /* #arguments, except *args */ | |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39610
diff
changeset
|
13 int co_kwonlyargcount; /* #keyword only arguments */ |
| 35742 | 14 int co_nlocals; /* #local variables */ |
| 15 int co_stacksize; /* #entries needed for evaluation stack */ | |
| 16 int co_flags; /* CO_..., see below */ | |
| 17 PyObject *co_code; /* instruction opcodes */ | |
| 18 PyObject *co_consts; /* list (constants used) */ | |
| 19 PyObject *co_names; /* list of strings (names used) */ | |
| 20 PyObject *co_varnames; /* tuple of strings (local variable names) */ | |
| 21 PyObject *co_freevars; /* tuple of strings (free variable names) */ | |
| 22 PyObject *co_cellvars; /* tuple of strings (cell variable names) */ | |
|
51248
410dfd423ef1
Merged revisions 69188 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents:
46885
diff
changeset
|
23 /* The rest doesn't count for hash or comparisons */ |
|
43569
19319e70fc3e
Patch #1272, by Christian Heimes and Alexandre Vassalotti.
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
24 PyObject *co_filename; /* unicode (where it was loaded from) */ |
|
19319e70fc3e
Patch #1272, by Christian Heimes and Alexandre Vassalotti.
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
25 PyObject *co_name; /* unicode (name, for reference) */ |
| 35742 | 26 int co_firstlineno; /* first source line number */ |
|
55372
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
27 PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
28 Objects/lnotab_notes.txt for details. */ |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
29 void *co_zombieframe; /* for optimization only (see frameobject.c) */ |
| 35742 | 30 } PyCodeObject; |
| 31 | |
| 32 /* Masks for co_flags above */ | |
| 33 #define CO_OPTIMIZED 0x0001 | |
| 34 #define CO_NEWLOCALS 0x0002 | |
| 35 #define CO_VARARGS 0x0004 | |
| 36 #define CO_VARKEYWORDS 0x0008 | |
| 37 #define CO_NESTED 0x0010 | |
| 38 #define CO_GENERATOR 0x0020 | |
| 39 /* The CO_NOFREE flag is set if there are no free or cell variables. | |
| 40 This information is redundant, but it allows a single flag test | |
| 41 to determine whether there is any extra work to be done when the | |
| 42 call frame it setup. | |
| 43 */ | |
| 44 #define CO_NOFREE 0x0040 | |
|
36602
9c0fd586475c
Generators have been permanent for a while. This comment is no longer applicable.
Neal Norwitz <nnorwitz@gmail.com>
parents:
35744
diff
changeset
|
45 |
|
36988
49c6eb688906
Checkpoint. 218 tests are okay; 53 are failing. Done so far:
Guido van Rossum <guido@python.org>
parents:
36726
diff
changeset
|
46 /* These are no longer used. */ |
|
55060
cc6b91c3d719
a little more fiddling to make flags like 2.x
Benjamin Peterson <benjamin@python.org>
parents:
55059
diff
changeset
|
47 #if 0 |
|
36654
6b42920accc9
Per discussion on python-dev, remove CO_GENERATOR_ALLOWED. Leave comment about not removing yet.
Neal Norwitz <nnorwitz@gmail.com>
parents:
36602
diff
changeset
|
48 #define CO_GENERATOR_ALLOWED 0x1000 |
|
55060
cc6b91c3d719
a little more fiddling to make flags like 2.x
Benjamin Peterson <benjamin@python.org>
parents:
55059
diff
changeset
|
49 #endif |
| 35742 | 50 #define CO_FUTURE_DIVISION 0x2000 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
51 #define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ |
|
36726
bbf16fd024df
from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents:
36712
diff
changeset
|
52 #define CO_FUTURE_WITH_STATEMENT 0x8000 |
|
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:
44351
diff
changeset
|
53 #define CO_FUTURE_PRINT_FUNCTION 0x10000 |
|
46120
78504d604b44
Merged revisions 61952-61953 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45965
diff
changeset
|
54 #define CO_FUTURE_UNICODE_LITERALS 0x20000 |
|
36726
bbf16fd024df
from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents:
36712
diff
changeset
|
55 |
|
52641
0530aadff696
The BDFL has retired! Long live the FLUFL (Friendly Language Uncle For Life)!
Brett Cannon <bcannon@gmail.com>
parents:
51248
diff
changeset
|
56 #define CO_FUTURE_BARRY_AS_BDFL 0x40000 |
|
0530aadff696
The BDFL has retired! Long live the FLUFL (Friendly Language Uncle For Life)!
Brett Cannon <bcannon@gmail.com>
parents:
51248
diff
changeset
|
57 |
|
36726
bbf16fd024df
from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents:
36712
diff
changeset
|
58 /* This should be defined if a future statement modifies the syntax. |
|
bbf16fd024df
from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents:
36712
diff
changeset
|
59 For example, when a keyword is added. |
|
bbf16fd024df
from __future__ import with_statement addon for 'with', mostly written by
Thomas Wouters <thomas@python.org>
parents:
36712
diff
changeset
|
60 */ |
|
52641
0530aadff696
The BDFL has retired! Long live the FLUFL (Friendly Language Uncle For Life)!
Brett Cannon <bcannon@gmail.com>
parents:
51248
diff
changeset
|
61 #define PY_PARSER_REQUIRES_FUTURE_KEYWORD |
| 35742 | 62 |
| 63 #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ | |
| 64 | |
|
35744
e7815495bb27
Use the newer names for APIs after the AST merge
Neal Norwitz <nnorwitz@gmail.com>
parents:
35742
diff
changeset
|
65 PyAPI_DATA(PyTypeObject) PyCode_Type; |
| 35742 | 66 |
|
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:
43569
diff
changeset
|
67 #define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) |
| 35742 | 68 #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) |
| 69 | |
| 70 /* Public interface */ | |
|
35744
e7815495bb27
Use the newer names for APIs after the AST merge
Neal Norwitz <nnorwitz@gmail.com>
parents:
35742
diff
changeset
|
71 PyAPI_FUNC(PyCodeObject *) PyCode_New( |
|
40215
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39610
diff
changeset
|
72 int, int, int, int, int, PyObject *, PyObject *, |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39610
diff
changeset
|
73 PyObject *, PyObject *, PyObject *, PyObject *, |
|
1cce0526d9b0
Jiwon Seo's PEP 3102 implementation.
Guido van Rossum <guido@python.org>
parents:
39610
diff
changeset
|
74 PyObject *, PyObject *, int, PyObject *); |
| 35742 | 75 /* same as struct above */ |
|
55372
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
76 |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
77 /* Creates a new empty code object with the specified source location. */ |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
78 PyAPI_FUNC(PyCodeObject *) |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
79 PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
80 |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
81 /* Return the line number associated with the specified bytecode index |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
82 in this code object. If you just need the line number of a frame, |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
83 use PyFrame_GetLineNumber() instead. */ |
|
35744
e7815495bb27
Use the newer names for APIs after the AST merge
Neal Norwitz <nnorwitz@gmail.com>
parents:
35742
diff
changeset
|
84 PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); |
| 35742 | 85 |
| 86 /* for internal use only */ | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
87 typedef struct _addr_pair { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
88 int ap_lower; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
89 int ap_upper; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
90 } PyAddrPair; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
91 |
|
55372
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
92 /* Update *bounds to describe the first and one-past-the-last instructions in the |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
93 same line as lasti. Return the number of that line. |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
94 */ |
|
55372
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
95 PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
55060
diff
changeset
|
96 int lasti, PyAddrPair *bounds); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36988
diff
changeset
|
97 |
|
39610
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
98 PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
99 PyObject *names, PyObject *lineno_obj); |
|
3674f20ac781
Merge current trunk into p3yk. This includes the PyNumber_Index API change,
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
100 |
| 35742 | 101 #ifdef __cplusplus |
| 102 } | |
| 103 #endif | |
| 104 #endif /* !Py_CODE_H */ |
