Skip to content

bpo-17735: make inspect.findsource raise OsError instead of IndexError wh… #23633

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

Merged
merged 3 commits into from
Dec 4, 2020

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Dec 3, 2020

…en co_lineno is larger than length of file (can happen if file was updated since import)

The docstring says this function raises OSError when it can't find the source, so we make it so.
(The bpo is about the consequence of help() not handling IndexError.)

https://bugs.python.org/issue17735

@iritkatriel iritkatriel changed the title bpo-17735: inspect.findsource raises OsError instead of IndexError wh… bpo-17735: make inspect.findsource raise OsError instead of IndexError wh… Dec 3, 2020
@iritkatriel iritkatriel requested a review from taleinat December 3, 2020 22:27
iritkatriel and others added 2 commits December 4, 2020 17:01
…en co_lineno is larger than length of file (can happen if file was updated since import)
Copy link
Contributor

@taleinat taleinat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taleinat taleinat merged commit 2e0760b into python:master Dec 4, 2020
@taleinat taleinat added needs backport to 3.8 needs backport to 3.9 only security fixes type-bug An unexpected behavior, bug, or error labels Dec 4, 2020
@miss-islington
Copy link
Contributor

Thanks @iritkatriel for the PR, and @taleinat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @iritkatriel for the PR, and @taleinat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 4, 2020
…t of range (pythonGH-23633)

This can happen when a file was edited after it was imported.
(cherry picked from commit 2e0760b)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Dec 4, 2020
@bedevere-bot
Copy link

GH-23646 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 4, 2020
…t of range (pythonGH-23633)

This can happen when a file was edited after it was imported.
(cherry picked from commit 2e0760b)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
@bedevere-bot
Copy link

GH-23647 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Dec 4, 2020
…t of range (GH-23633)

This can happen when a file was edited after it was imported.
(cherry picked from commit 2e0760b)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
taleinat pushed a commit that referenced this pull request Dec 4, 2020
…t of range (GH-23633)

This can happen when a file was edited after it was imported.
(cherry picked from commit 2e0760b)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…t of range (pythonGH-23633)

This can happen when a file was edited after it was imported.
@iritkatriel iritkatriel deleted the bpo-17735 branch June 18, 2021 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants