Skip to content

bpo-44461: Check early that a pdb target is valid for execution. #27227

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 5 commits into from
Jul 28, 2021
Merged

bpo-44461: Check early that a pdb target is valid for execution. #27227

merged 5 commits into from
Jul 28, 2021

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Jul 18, 2021

  • bpo-44461: Fix bug with pdb's handling of import error due to a package which does not have a main module
  • 📜🤖 Added by blurb_it.
  • remove "else"
  • If running as a module, first check that it can run as a module. Alternate fix for bpo-44461.

https://bugs.python.org/issue44461

@jaraco
Copy link
Member Author

jaraco commented Jul 18, 2021

This PR builds on the work @iritkatriel began in GH-26937 and which I submitted for review in iritkatriel#18. This change addresses the root cause more directly (more closely aligning the behaviors of module-based invocation with script-based invocation) by checking early whether an indicated runpy target is actually valid for execution. This change addresses the issue more surgically, applying the fix in a single location and only in pdb.main.

@iritkatriel iritkatriel removed needs backport to 3.10 only security fixes needs backport to 3.9 only security fixes labels Jul 20, 2021
@iritkatriel iritkatriel changed the title bpo-44461: Check early that a runpy target is valid for execution. bpo-44461: Check early that a pdb target is valid for execution. Jul 26, 2021
@jaraco jaraco added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Jul 28, 2021
@jaraco
Copy link
Member Author

jaraco commented Jul 28, 2021

I see you removed the backport labels, but I do want to backport this bugfix. I know the bugfix can't be backported automatically, but it should be able to be translated to the old approach, as I've demonstrated in iritkatriel#18.

@jaraco jaraco merged commit ee03bad into python:main Jul 28, 2021
@miss-islington
Copy link
Contributor

Thanks @jaraco for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot
Copy link

@jaraco: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Sorry, @jaraco, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ee03bad25e83b00ba5fc2a0265b48c6286e6b3f7 3.10

@miss-islington
Copy link
Contributor

Sorry @jaraco, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker ee03bad25e83b00ba5fc2a0265b48c6286e6b3f7 3.9

@jaraco jaraco deleted the bpo-44461-minimal branch July 28, 2021 01:51
jaraco added a commit that referenced this pull request Jul 28, 2021
…n. (GH-27227)

* bpo-44461: Fix bug with pdb's handling of import error due to a package which does not have a __main__ module

* 📜🤖 Added by blurb_it.

* remove "else"

Co-authored-by: Jason R. Coombs <[email protected]>

* If running as a module, first check that it can run as a module. Alternate fix for bpo-44461.

Co-authored-by: Irit Katriel <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Irit Katriel <[email protected]>.
(cherry picked from commit ee03bad)

Co-authored-by: Jason R. Coombs <[email protected]>
@bedevere-bot
Copy link

GH-27399 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 28, 2021
jaraco added a commit that referenced this pull request Jul 28, 2021
GH-27227)

* bpo-44461: Fix bug with pdb's handling of import error due to a package which does not have a __main__ module

* 📜🤖 Added by blurb_it.

* remove "else"

Co-authored-by: Jason R. Coombs <[email protected]>

* If running as a module, first check that it can run as a module. Alternate fix for bpo-44461.

Co-authored-by: Irit Katriel <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Irit Katriel <[email protected]>.
(cherry picked from commit ee03bad)

Co-authored-by: Jason R. Coombs <[email protected]>
@bedevere-bot
Copy link

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

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jul 28, 2021
miss-islington pushed a commit that referenced this pull request Jul 28, 2021
jaraco added a commit that referenced this pull request Jul 28, 2021
GH-27227) (GH-27400)

* [3.9] bpo-44461: Check early that a pdb target is valid for execution. (GH-27227)

* bpo-44461: Fix bug with pdb's handling of import error due to a package which does not have a __main__ module

* 📜🤖 Added by blurb_it.

* remove "else"

Co-authored-by: Jason R. Coombs <[email protected]>

* If running as a module, first check that it can run as a module. Alternate fix for bpo-44461.

Co-authored-by: Irit Katriel
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Irit Katriel <[email protected]>.
(cherry picked from commit ee03bad)

Co-authored-by: Jason R. Coombs <[email protected]>

* Ensure os_helper is imported.

* Actually, os_helper doesn't exist yet. Just reference rmtree from support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants