Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions 8 Lib/test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,14 @@ def or_false(x):
self.assertIn('LOAD_', opcodes[0].opname)
self.assertEqual('RETURN_VALUE', opcodes[1].opname)

def test_lineno_procedure_call(self):
def call():
(
print()
)
line1 = call.__code__.co_firstlineno + 1
assert line1 not in [line for (_, _, line) in call.__code__.co_lines()]

def test_lineno_after_implicit_return(self):
TRUE = True
# Don't use constant True or False, as compiler will remove test
Expand Down
2 changes: 2 additions & 0 deletions 2 Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3397,6 +3397,8 @@ compiler_visit_stmt_expr(struct compiler *c, expr_ty value)
}

VISIT(c, expr, value);
/* Mark POP_TOP as artificial */
c->u->u_lineno = -1;
ADDOP(c, POP_TOP);
return 1;
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.