From 0ccff074cd806bc7e963a1e0ff6ce25e0d11cce9 Mon Sep 17 00:00:00 2001 From: "Michael W. Hudson" Date: Tue, 17 Aug 2004 17:29:16 +0000 Subject: This is Mark Russell's patch: [ 1009560 ] Fix @decorator evaluation order From the description: Changes in this patch: - Change Grammar/Grammar to require newlines between adjacent decorators. - Fix order of evaluation of decorators in the C (compile.c) and python (Lib/compiler/pycodegen.py) compilers - Add better order of evaluation check to test_decorators.py (test_eval_order) - Update the decorator documentation in the reference manual (improve description of evaluation order and update syntax description) and the comment: Used Brett's evaluation order (see http://mail.python.org/pipermail/python-dev/2004-August/047835.html) (I'm checking this in for Anthony who was having problems getting SF to talk to him) --- Lib/compiler/pycodegen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/compiler/pycodegen.py') diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index e5d1ff175a..02e7764047 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -367,12 +367,12 @@ class CodeGenerator: def _visitFuncOrLambda(self, node, isLambda=0): if not isLambda and node.decorators: - for decorator in reversed(node.decorators.nodes): + for decorator in node.decorators.nodes: self.visit(decorator) ndecorators = len(node.decorators.nodes) else: ndecorators = 0 - + gen = self.FunctionGen(node, self.scopes, isLambda, self.class_name, self.get_module()) walk(node.code, gen) -- cgit v1.2.1