bpo-32691: Use mod_spec.parent when running modules with pdb (GH-5474)

Previously the module name was used, which broke relative imports when pdb was run against a plain module or submodule.
This commit is contained in:
Mario Corchero 2018-02-03 06:40:11 +00:00 committed by Nick Coghlan
parent 4e9da0d163
commit 38bfa8418f
3 changed files with 34 additions and 2 deletions

View file

@ -1532,7 +1532,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
__main__.__dict__.update({
"__name__": "__main__",
"__file__": self.mainpyfile,
"__package__": module_name,
"__package__": mod_spec.parent,
"__loader__": mod_spec.loader,
"__spec__": mod_spec,
"__builtins__": __builtins__,