This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bottom-to-top decorator application order
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon
Priority: high Keywords: patch

Created on 2004-08-15 06:39 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
deco_order.diff brett.cannon, 2004-08-15 06:39 Patch to apply decorators bottom up
Messages (2)
msg46710 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-08-15 06:39
If you read http://mail.python.org/pipermail/python-dev/2004-
August/047512.html you will find out that Guido meant for the 
application order to go bottom-to-top (or right-recursive if you 
think of it as being in a list).  That means that::

  @first
  @second
  def blah(): pass

will end up doing::

  blah = first(second(blah))

The attached patch fixes Python/compile.c to follow this order and 
changes Lib/test/test_decorators.py to test for this order.
msg46711 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2004-08-15 07:32
Logged In: YES 
user_id=357491

Well, I went ahead and applied the patch figuring it was just so simple 
and the tests passed it was silly to wait for people to check a two line 
change in Python/compile.c .

Applied as:
* Python/compile.c
      rev. 2.318
* Lib/test/test_decorators.py
      rev. 1.4
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40761
2004-08-15 06:39:58brett.cannoncreate