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
fix code
  • Loading branch information
youknowone committed Dec 30, 2025
commit 24dc19dbefdf6a0c93e2f3f9ec3241c12ec29b4d
4 changes: 2 additions & 2 deletions Lib/test/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def test_co_positions_artificial_instructions(self):
]
)

# TODO: RUSTPYTHON
# TODO: RUSTPYTHON; no_debug_ranges option not supported
@unittest.expectedFailure
def test_endline_and_columntable_none_when_no_debug_ranges(self):
# Make sure that if `-X no_debug_ranges` is used, there is
Expand All @@ -442,7 +442,7 @@ def f():
""")
assert_python_ok('-X', 'no_debug_ranges', '-c', code)

# TODO: RUSTPYTHON
# TODO: RUSTPYTHON; no_debug_ranges option not supported
@unittest.expectedFailure
def test_endline_and_columntable_none_when_no_debug_ranges_env(self):
# Same as above but using the environment variable opt out.
Expand Down
12 changes: 2 additions & 10 deletions crates/vm/src/builtins/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,18 +809,10 @@ impl PyCode {
Some(line + end_line_delta)
};

// Convert Option to PyObject (None or int)
// If column == end_column, treat as if column info is not available
// This happens because RustPython's linetable doesn't store separate
// start/end column info
let (final_column, final_end_column) = match (column, end_column) {
(Some(c), Some(ec)) if c == ec => (None, None),
_ => (column, end_column),
};
let line_obj = final_line.to_pyobject(vm);
let end_line_obj = final_endline.to_pyobject(vm);
let column_obj = final_column.to_pyobject(vm);
let end_column_obj = final_end_column.to_pyobject(vm);
let column_obj = column.to_pyobject(vm);
let end_column_obj = end_column.to_pyobject(vm);

let tuple =
vm.ctx
Expand Down