File indexing completed on 2025-01-30 10:18:03
0001 #ifndef Py_CPYTHON_COMPILE_H
0002 # error "this header file must not be included directly"
0003 #endif
0004
0005
0006 #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
0007 CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
0008 CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
0009 CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
0010 #define PyCF_MASK_OBSOLETE (CO_NESTED)
0011
0012
0013
0014
0015 #define PyCF_SOURCE_IS_UTF8 0x0100
0016 #define PyCF_DONT_IMPLY_DEDENT 0x0200
0017 #define PyCF_ONLY_AST 0x0400
0018 #define PyCF_IGNORE_COOKIE 0x0800
0019 #define PyCF_TYPE_COMMENTS 0x1000
0020 #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
0021 #define PyCF_ALLOW_INCOMPLETE_INPUT 0x4000
0022 #define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
0023 PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT | \
0024 PyCF_ALLOW_INCOMPLETE_INPUT)
0025
0026 typedef struct {
0027 int cf_flags;
0028 int cf_feature_version;
0029 } PyCompilerFlags;
0030
0031 #define _PyCompilerFlags_INIT \
0032 (PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
0033
0034
0035 typedef struct {
0036 int lineno;
0037 int end_lineno;
0038 int col_offset;
0039 int end_col_offset;
0040 } _PyCompilerSrcLocation;
0041
0042 #define SRC_LOCATION_FROM_AST(n) \
0043 (_PyCompilerSrcLocation){ \
0044 .lineno = (n)->lineno, \
0045 .end_lineno = (n)->end_lineno, \
0046 .col_offset = (n)->col_offset, \
0047 .end_col_offset = (n)->end_col_offset }
0048
0049
0050
0051 typedef struct {
0052 int ff_features;
0053 _PyCompilerSrcLocation ff_location;
0054 } PyFutureFeatures;
0055
0056 #define FUTURE_NESTED_SCOPES "nested_scopes"
0057 #define FUTURE_GENERATORS "generators"
0058 #define FUTURE_DIVISION "division"
0059 #define FUTURE_ABSOLUTE_IMPORT "absolute_import"
0060 #define FUTURE_WITH_STATEMENT "with_statement"
0061 #define FUTURE_PRINT_FUNCTION "print_function"
0062 #define FUTURE_UNICODE_LITERALS "unicode_literals"
0063 #define FUTURE_BARRY_AS_BDFL "barry_as_FLUFL"
0064 #define FUTURE_GENERATOR_STOP "generator_stop"
0065 #define FUTURE_ANNOTATIONS "annotations"
0066
0067 #define PY_INVALID_STACK_EFFECT INT_MAX
0068 PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
0069 PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);