summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_symtable.h
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-04-02 10:34:49 (GMT)
committerGitHub <noreply@github.com>2024-04-02 10:34:49 (GMT)
commit1d5479b236e9a66dd32a24eff6fb83e3242b999d (patch)
tree58952ccbc1825b1b7a3004a5971bd4a9a23b2dca /Include/internal/pycore_symtable.h
parent5fd1897ec51cb64ef7990ada538fcd8d9ca1f74b (diff)
downloadcpython-1d5479b236e9a66dd32a24eff6fb83e3242b999d.zip
cpython-1d5479b236e9a66dd32a24eff6fb83e3242b999d.tar.gz
cpython-1d5479b236e9a66dd32a24eff6fb83e3242b999d.tar.bz2
gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private (#117412)
Diffstat (limited to 'Include/internal/pycore_symtable.h')
-rw-r--r--Include/internal/pycore_symtable.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/Include/internal/pycore_symtable.h b/Include/internal/pycore_symtable.h
index b44393b..16e89f8 100644
--- a/Include/internal/pycore_symtable.h
+++ b/Include/internal/pycore_symtable.h
@@ -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
}