aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Include/code.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/code.h')
-rw-r--r--Include/code.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/Include/code.h b/Include/code.h
index 38b2958046a..e773b6a47ce 100644
--- a/Include/code.h
+++ b/Include/code.h
@@ -1,5 +1,6 @@
/* Definitions for bytecode */
+#ifndef Py_LIMITED_API
#ifndef Py_CODE_H
#define Py_CODE_H
#ifdef __cplusplus
@@ -10,6 +11,7 @@ extern "C" {
typedef struct {
PyObject_HEAD
int co_argcount; /* #arguments, except *args */
+ int co_kwonlyargcount; /* #keyword only arguments */
int co_nlocals; /* #local variables */
int co_stacksize; /* #entries needed for evaluation stack */
int co_flags; /* CO_..., see below */
@@ -19,9 +21,9 @@ typedef struct {
PyObject *co_varnames; /* tuple of strings (local variable names) */
PyObject *co_freevars; /* tuple of strings (free variable names) */
PyObject *co_cellvars; /* tuple of strings (cell variable names) */
- /* The rest doesn't count for hash/cmp */
- PyObject *co_filename; /* string (where it was loaded from) */
- PyObject *co_name; /* string (name, for reference) */
+ /* The rest doesn't count for hash or comparisons */
+ PyObject *co_filename; /* unicode (where it was loaded from) */
+ PyObject *co_name; /* unicode (name, for reference) */
int co_firstlineno; /* first source line number */
PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See
Objects/lnotab_notes.txt for details. */
@@ -43,8 +45,8 @@ typedef struct {
*/
#define CO_NOFREE 0x0040
+/* These are no longer used. */
#if 0
-/* This is no longer used. Stopped defining in 2.5, do not re-use. */
#define CO_GENERATOR_ALLOWED 0x1000
#endif
#define CO_FUTURE_DIVISION 0x2000
@@ -53,12 +55,12 @@ typedef struct {
#define CO_FUTURE_PRINT_FUNCTION 0x10000
#define CO_FUTURE_UNICODE_LITERALS 0x20000
+#define CO_FUTURE_BARRY_AS_BDFL 0x40000
+
/* This should be defined if a future statement modifies the syntax.
For example, when a keyword is added.
*/
-#if 1
#define PY_PARSER_REQUIRES_FUTURE_KEYWORD
-#endif
#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */
@@ -69,8 +71,9 @@ PyAPI_DATA(PyTypeObject) PyCode_Type;
/* Public interface */
PyAPI_FUNC(PyCodeObject *) PyCode_New(
- int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *,
- PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *);
+ int, int, int, int, int, PyObject *, PyObject *,
+ PyObject *, PyObject *, PyObject *, PyObject *,
+ PyObject *, PyObject *, int, PyObject *);
/* same as struct above */
/* Creates a new empty code object with the specified source location. */
@@ -83,10 +86,6 @@ PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno);
PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int);
/* for internal use only */
-#define _PyCode_GETCODEPTR(co, pp) \
- ((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \
- ((co)->co_code, 0, (void **)(pp)))
-
typedef struct _addr_pair {
int ap_lower;
int ap_upper;
@@ -95,8 +94,10 @@ typedef struct _addr_pair {
/* Update *bounds to describe the first and one-past-the-last instructions in the
same line as lasti. Return the number of that line.
*/
+#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co,
int lasti, PyAddrPair *bounds);
+#endif
PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
PyObject *names, PyObject *lineno_obj);
@@ -105,3 +106,4 @@ PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
}
#endif
#endif /* !Py_CODE_H */
+#endif /* Py_LIMITED_API */