-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Let's say I pre-define an option meant for multiple commands:
opt = click.option('opt', cls=CustomOption)
@opt
def cmd1(opt):
pass
@opt
def cmd2(opt):
passThis will (click 6.7, and latest master when this issue was created) cause the cls parameter to be popped from **attrs – which is shared between all calls of the inner decorator, because of the closure – in the first call, leading to a broken option in the second call.
Of course, it's possible to work around this by instead defining a function that returns the option, but it would be nice to just fix the decorators by copying attrs before popping cls.
ulope and dsully