mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
gh-83035: handle decorator with nested parens in inspect.getsource (#99654)
This commit is contained in:
parent
b11a384dc7
commit
68e41295b8
4 changed files with 22 additions and 9 deletions
|
@ -259,3 +259,17 @@ def all_markers_with_args_and_kwargs(a, b, /, c, d, *args, e, f, **kwargs):
|
|||
#line 259
|
||||
def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5):
|
||||
pass
|
||||
|
||||
# line 263
|
||||
def deco_factory(**kwargs):
|
||||
def deco(f):
|
||||
@wraps(f)
|
||||
def wrapper(*a, **kwd):
|
||||
kwd.update(kwargs)
|
||||
return f(*a, **kwd)
|
||||
return wrapper
|
||||
return deco
|
||||
|
||||
@deco_factory(foo=(1 + 2), bar=lambda: 1)
|
||||
def complex_decorated(foo=0, bar=lambda: 0):
|
||||
return foo + bar()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue