summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-07-28 01:51:42 (GMT)
committerGitHub <noreply@github.com>2021-07-28 01:51:42 (GMT)
commitee03bad25e83b00ba5fc2a0265b48c6286e6b3f7 (patch)
tree158d1626a8fe583ee120147abbc649a4e7d21a0a /Lib/pdb.py
parent38ddc8beb38d9a685de296a58b0741850e4853e5 (diff)
downloadcpython-ee03bad25e83b00ba5fc2a0265b48c6286e6b3f7.zip
cpython-ee03bad25e83b00ba5fc2a0265b48c6286e6b3f7.tar.gz
cpython-ee03bad25e83b00ba5fc2a0265b48c6286e6b3f7.tar.bz2
bpo-44461: Check early that a pdb target is valid for execution. (#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 <jaraco@jaraco.com> * If running as a module, first check that it can run as a module. Alternate fix for bpo-44461. Co-authored-by: Irit Katriel <iritkatriel@yahoo.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index e769ad7..8aa899f 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -169,7 +169,11 @@ class ScriptTarget(str):
class ModuleTarget(str):
def check(self):
- pass
+ try:
+ self._details
+ except Exception:
+ traceback.print_exc()
+ sys.exit(1)
@functools.cached_property
def _details(self):