Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dedba1f
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
494a3a5
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
1865ac8
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
affb018
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
f15aa44
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
18f79a7
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
ed98ae3
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
c99b286
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
551256b
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
165d763
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
3e79c5c
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
dd4f5bb
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 15, 2022
0ce3fef
📜🤖 Added by blurb_it.
blurb-it[bot] May 16, 2022
00d8452
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
c6c5d9d
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
801b237
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
867b182
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
2f04d08
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
47b8756
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
13b9a52
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
0403cbb
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
2f3d44d
bpo-43950: Implement fine grained error locations for interactive mode
thatbirdguythatuknownot May 16, 2022
72f9079
Update peg_extension.c
thatbirdguythatuknownot May 16, 2022
847e77f
Don't try to get the source of the file
thatbirdguythatuknownot May 16, 2022
f12ac1b
Don't get the source of the file
thatbirdguythatuknownot May 16, 2022
b1fb696
Handle the case of <string>
thatbirdguythatuknownot May 17, 2022
bc5b734
Use `Py_XINCREF` instead of `Py_INCREF`
thatbirdguythatuknownot May 17, 2022
d401e86
Skip file-related operations when file is either `<stdin>` or `<string>`
thatbirdguythatuknownot May 17, 2022
a910c19
Py_INCREF the source line to prevent negative reference count
thatbirdguythatuknownot May 20, 2022
5dab69e
Get proper line from possible multilined statement
thatbirdguythatuknownot May 20, 2022
10a0796
Update traceback.c
thatbirdguythatuknownot May 20, 2022
29141b8
Get proper length of the unicode string
thatbirdguythatuknownot May 20, 2022
5345744
Merge branch 'main' into patch-22
thatbirdguythatuknownot Jun 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-43950: Implement fine grained error locations for interactive mode
  • Loading branch information
thatbirdguythatuknownot authored May 15, 2022
commit c99b286611554231802cbcafa9f5d533bc71e386
10 changes: 8 additions & 2 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ struct compiler {
struct compiler_unit *u; /* compiler state for current block */
PyObject *c_stack; /* Python list holding compiler_unit ptrs */
PyArena *c_arena; /* pointer to memory allocation arena */
PyObject *c_source; /* source code of a file/interactive line */
};

typedef struct {
Expand Down Expand Up @@ -538,8 +539,8 @@ compiler_init(struct compiler *c)
}

PyCodeObject *
_PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
int optimize, PyArena *arena)
_PyAST_Compile(mod_ty mod, PyObject *source, PyObject *filename,
PyCompilerFlags *flags, int optimize, PyArena *arena)
{
struct compiler c;
PyCodeObject *co = NULL;
Expand All @@ -562,6 +563,7 @@ _PyAST_Compile(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
c.c_flags = flags;
c.c_optimize = (optimize == -1) ? _Py_GetConfig()->optimization_level : optimize;
c.c_nestlevel = 0;
c.c_source = source;

_PyASTOptimizeState state;
state.optimize = c.c_optimize;
Expand Down Expand Up @@ -596,6 +598,7 @@ compiler_free(struct compiler *c)
Py_XDECREF(c->c_filename);
Py_DECREF(c->c_const_cache);
Py_DECREF(c->c_stack);
Py_XDECREF(c->c_source);
}

static PyObject *
Expand Down Expand Up @@ -8438,6 +8441,9 @@ assemble(struct compiler *c, int addNone)
}

co = makecode(c, &a, consts, maxdepth, nlocalsplus);
if (co) {
co->co_source = c->c_source;
}
error:
Py_XDECREF(consts);
assemble_free(&a);
Expand Down