gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private (#117412)

This commit is contained in:
Irit Katriel 2024-04-02 11:34:49 +01:00 committed by GitHub
parent 5fd1897ec5
commit 1d5479b236
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 49 additions and 42 deletions

View file

@ -29,6 +29,29 @@ typedef enum _comprehension_type {
SetComprehension = 3,
GeneratorExpression = 4 } _Py_comprehension_ty;
/* source location information */
typedef struct {
int lineno;
int end_lineno;
int col_offset;
int end_col_offset;
} _Py_SourceLocation;
#define SRC_LOCATION_FROM_AST(n) \
(_Py_SourceLocation){ \
.lineno = (n)->lineno, \
.end_lineno = (n)->end_lineno, \
.col_offset = (n)->col_offset, \
.end_col_offset = (n)->end_col_offset }
static const _Py_SourceLocation NO_LOCATION = {-1, -1, -1, -1};
/* __future__ information */
typedef struct {
int ff_features; /* flags set by future statements */
_Py_SourceLocation ff_location; /* location of last future statement */
} _PyFutureFeatures;
struct _symtable_entry;
struct symtable {
@ -44,7 +67,7 @@ struct symtable {
consistency with the corresponding
compiler structure */
PyObject *st_private; /* name of current class or NULL */
PyFutureFeatures *st_future; /* module's future features that affect
_PyFutureFeatures *st_future; /* module's future features that affect
the symbol table */
int recursion_depth; /* current recursion depth */
int recursion_limit; /* recursion limit */
@ -100,7 +123,7 @@ extern int _PyST_IsFunctionLike(PySTEntryObject *);
extern struct symtable* _PySymtable_Build(
struct _mod *mod,
PyObject *filename,
PyFutureFeatures *future);
_PyFutureFeatures *future);
extern PySTEntryObject* _PySymtable_Lookup(struct symtable *, void *);
extern void _PySymtable_Free(struct symtable *);
@ -150,7 +173,7 @@ extern struct symtable* _Py_SymtableStringObjectFlags(
int _PyFuture_FromAST(
struct _mod * mod,
PyObject *filename,
PyFutureFeatures* futures);
_PyFutureFeatures* futures);
#ifdef __cplusplus
}