Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Remove end-line table from code objects.
  • Loading branch information
markshannon committed Apr 14, 2022
commit 6f69354fc24aaee0e39a14aebcab51594a172ed7
8 changes: 2 additions & 6 deletions Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ typedef uint16_t _Py_CODEUNIT;
PyObject *co_linetable; /* bytes (encoding addr<->lineno mapping) \
See Objects/lnotab_notes.txt for details. \
*/ \
PyObject *co_endlinetable; /* bytes object that holds end lineno for \
instructions separated across different \
lines */ \
\
PyObject *co_locationtable; /* bytes object that holds location info */ \
PyObject *co_weakreflist; /* to support weakrefs to code objects */ \
/* Scratch space for extra data relating to the code object. \
Expand Down Expand Up @@ -152,13 +148,13 @@ PyAPI_FUNC(PyCodeObject *) PyCode_New(
int, int, int, int, int, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, int, PyObject *,
PyObject *, PyObject *, PyObject *);
PyObject *, PyObject *);

PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
int, int, int, int, int, int, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, PyObject *,
PyObject *, PyObject *, PyObject *, int, PyObject *,
PyObject *, PyObject *, PyObject *);
PyObject *, PyObject *);
/* same as struct above */

/* Creates a new empty code object with the specified source location. */
Expand Down
1 change: 0 additions & 1 deletion Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ struct _PyCodeConstructor {
PyObject *code;
int firstlineno;
PyObject *linetable;
PyObject *endlinetable;
PyObject *locationtable;

/* used by the code */
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def func(): pass
co.co_qualname,
co.co_firstlineno,
co.co_lnotab,
co.co_endlinetable,
co.co_locationtable,
co.co_exceptiontable,
co.co_freevars,
Expand Down Expand Up @@ -273,7 +272,6 @@ def func2():
("co_filename", "newfilename"),
("co_name", "newname"),
("co_linetable", code2.co_linetable),
("co_endlinetable", code2.co_endlinetable),
):
with self.subTest(attr=attr, value=value):
new_code = code.replace(**{attr: value})
Expand Down Expand Up @@ -311,7 +309,6 @@ def func():
co.co_qualname,
co.co_firstlineno,
co.co_lnotab,
co.co_endlinetable,
co.co_locationtable,
co.co_exceptiontable,
co.co_freevars,
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_different_filenames(self):
self.assertEqual(co2.co_filename, "f2")

@requires_debug_ranges()
def test_no_columntable_and_endlinetable_with_no_debug_ranges(self):
def test_minimal_locationtable_with_no_debug_ranges(self):
# Make sure when demarshalling objects with `-X no_debug_ranges`
# that the columns are None.
co = ExceptionTestCase.test_exceptions.__code__
Expand Down
73 changes: 33 additions & 40 deletions Objects/clinic/codeobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading