diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index 3f5ef890d90..904d0669749 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -495,6 +495,7 @@ class CodeGenerator: # misc def visitDiscard(self, node): + self.set_lineno(node) self.visit(node.expr) self.emit('POP_TOP') diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py index 3f5ef890d90..904d0669749 100644 --- a/Tools/compiler/compiler/pycodegen.py +++ b/Tools/compiler/compiler/pycodegen.py @@ -495,6 +495,7 @@ class CodeGenerator: # misc def visitDiscard(self, node): + self.set_lineno(node) self.visit(node.expr) self.emit('POP_TOP')