The Wayback Machine - https://web.archive.org/web/20221223131502/https://github.com/python/cpython/pull/21425
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] inspect: BlockFinder: handle nested parens with decorators #21425

Closed

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jul 9, 2020

Fixes:

import inspect

def deco(*args, **kwargs):
    def wrapped(f):
        return f
    return wrapped

@deco((lambda: True), (lambda: False))
def func():
    pass

print(inspect.getsource(func))

Without this patch it would only print:

@deco((lambda: True), (lambda: False))

TODO:

Related: #17374

Fixes:
```
import inspect

def deco(*args, **kwargs):
    def wrapped(f):
        return f
    return wrapped

@Deco((lambda: True), (lambda: False))
def func():
    pass

print(inspect.getsource(func))
```

Without this patch it would only print:

> @Deco((lambda: True), (lambda: False))
@blueyed blueyed changed the title inspect: BlockFinder: handle nested parens with decorators [RFC] inspect: BlockFinder: handle nested parens with decorators Jul 9, 2020
@Deco
Copy link

Deco commented Jul 10, 2020

@blueyed You called?

@ahopkins
Copy link

ahopkins commented Feb 28, 2022

Still an issue in need of merge. I opened a similar PR before finding this one.

#31605

Copy link
Member

@iritkatriel iritkatriel left a comment

This PR needs a unit test and news item.

@bedevere-bot
Copy link

bedevere-bot commented Dec 6, 2022

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@AlexWaygood
Copy link
Member

AlexWaygood commented Dec 7, 2022

@carljm, am I correct in thinking this has been superseded by #99654?

@carljm
Copy link
Contributor

carljm commented Dec 7, 2022

Yep, superseded.

@carljm carljm closed this Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants