Content-Length: 327488 | pFad | https://github.com/python/cpython/pull/137479

3C gh-137477: Extend regex pattern check in `inspect.findsource` by George-Ogden · Pull Request #137479 · python/cpython · GitHub
Skip to content

gh-137477: Extend regex pattern check in inspect.findsource#137479

Closed
George-Ogden wants to merge 2 commits into
python:mainfrom
George-Ogden:fix-issue-137477-main
Closed

gh-137477: Extend regex pattern check in inspect.findsource#137479
George-Ogden wants to merge 2 commits into
python:mainfrom
George-Ogden:fix-issue-137477-main

Conversation

@George-Ogden

@George-Ogden George-Ogden commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

This reintroduces the regex removed in #117025 with an additional case for classes.
While this is still a more hacky solution than AST parsing, etc, it handles class definitions and edge cases where the source code line is incorrect (generator bytecode).

@python-cla-bot

python-cla-bot Bot commented Aug 6, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Aug 6, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app

bedevere-app Bot commented Aug 6, 2025

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@StanFromIreland StanFromIreland changed the title gh-137477 Extend regex pattern check in inspect.findsource gh-137477: Extend regex pattern check in inspect.findsource Aug 6, 2025
@serhiy-storchaka

Copy link
Copy Markdown
Member

Thank you for your report and PR, @George-Ogden, but I think that #137488 is more correct solution.

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.

2 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/137479

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy