From 01d12937dfe827810b716625ce297ace44a3a6d2 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 11 Apr 2001 16:36:25 +0000 Subject: [PATCH] [finishing fix from earlier checkins] Call set_lineno() in visitDiscard(), which will generate linenos for discard statements, e.g. the statement "1/0" Fixes SF bug #409587 --- Lib/compiler/pycodegen.py | 1 + Tools/compiler/compiler/pycodegen.py | 1 + 2 files changed, 2 insertions(+) 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')