diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-07-02 17:22:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-02 16:22:08 +0000 |
commit | 1ac273224a85126c4356e355f7445206fadde7ec (patch) | |
tree | 9555c45781daca3e8f81ba025e34b2effb92878f /Python/compile.c | |
parent | 6343486eb60ac5a9e15402a592298259c5afdee1 (diff) | |
download | cpython-1ac273224a85126c4356e355f7445206fadde7ec.tar.gz cpython-1ac273224a85126c4356e355f7445206fadde7ec.zip |
gh-121272: move __future__ import validation from compiler to symtable (#121273)
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/Python/compile.c b/Python/compile.c index 69de0ec2996..d33db69f425 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -77,14 +77,6 @@ typedef struct _PyCfgBuilder cfg_builder; #define LOCATION(LNO, END_LNO, COL, END_COL) \ ((const _Py_SourceLocation){(LNO), (END_LNO), (COL), (END_COL)}) -/* Return true if loc1 starts after loc2 ends. */ -static inline bool -location_is_after(location loc1, location loc2) { - return (loc1.lineno > loc2.end_lineno) || - ((loc1.lineno == loc2.end_lineno) && - (loc1.col_offset > loc2.end_col_offset)); -} - #define LOC(x) SRC_LOCATION_FROM_AST(x) typedef _PyJumpTargetLabel jump_target_label; @@ -3847,14 +3839,6 @@ compiler_from_import(struct compiler *c, stmt_ty s) PyTuple_SET_ITEM(names, i, Py_NewRef(alias->name)); } - if (location_is_after(LOC(s), c->c_future.ff_location) && - s->v.ImportFrom.module && s->v.ImportFrom.level == 0 && - _PyUnicode_EqualToASCIIString(s->v.ImportFrom.module, "__future__")) - { - Py_DECREF(names); - return compiler_error(c, LOC(s), "from __future__ imports must occur " - "at the beginning of the file"); - } ADDOP_LOAD_CONST_NEW(c, LOC(s), names); if (s->v.ImportFrom.module) { |