Issue32691
Created on 2018-01-28 05:04 by ncoghlan, last changed 2018-02-05 02:39 by ncoghlan. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 5474 | merged | mariocj89, 2018-02-01 16:01 | |
| PR 5510 | merged | miss-islington, 2018-02-03 06:41 | |
| Messages (7) | |||
|---|---|---|---|
| msg310917 - (view) | Author: Nick Coghlan (ncoghlan) * | Date: 2018-01-28 05:04 | |
For regular modules, the initial implementation of bpo-32206 sets __package__ to "module_name" instead of "module_name.rpartition('.')[0]". This is not correct, and will cause problems for relative imports. (From https://bugs.python.org/issue32206#msg310882) |
|||
| msg310964 - (view) | Author: Jason R. Coombs (jaraco) * | Date: 2018-01-28 16:17 | |
In the backport, I found that `mod_spec.parent` seemed to be the right thing (in at least a few cases). Might that be preferable to `module_name.rpartition('.')[0]`?
|
|||
| msg311437 - (view) | Author: Mario Corchero (mariocj89) * | Date: 2018-02-01 15:19 | |
OK, just managed to reproduce it. This appears only when you run a python script as a module. Running a module with __main__ does not show the issue. Will get a patch ready |
|||
| msg311439 - (view) | Author: Nick Coghlan (ncoghlan) * | Date: 2018-02-01 15:25 | |
I forget we had mod_spec.parent available to us these days, so yes, we should use that rather than recalculating the parent with str.rpartition. As Mario noted, we only want to change the behaviour when the executed module is a plain module or submodule, rather than being a package in its own right with a pkg.__main__ submodule (since the current behaviour is correct in the latter case). |
|||
| msg311446 - (view) | Author: Mario Corchero (mariocj89) * | Date: 2018-02-01 16:22 | |
Sent a PR for the fix. I'll update PRs for trace. profile does not need it Thanks a lot for bringing it up Jason! |
|||
| msg311539 - (view) | Author: Nick Coghlan (ncoghlan) * | Date: 2018-02-03 06:40 | |
New changeset 38bfa8418f5d39bcc7478b8f7aef4a632c26172e by Nick Coghlan (Mario Corchero) in branch 'master': bpo-32691: Use mod_spec.parent when running modules with pdb (GH-5474) https://github.com/python/cpython/commit/38bfa8418f5d39bcc7478b8f7aef4a632c26172e |
|||
| msg311591 - (view) | Author: Nick Coghlan (ncoghlan) * | Date: 2018-02-04 08:07 | |
New changeset 1a0239e12e161609fdf68f13cedbabca9bf353f1 by Nick Coghlan (Miss Islington (bot)) in branch '3.7': [3.7] bpo-32691: Use mod_spec.parent when running modules with pdb (GH-5510) https://github.com/python/cpython/commit/1a0239e12e161609fdf68f13cedbabca9bf353f1 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-02-05 02:39:08 | ncoghlan | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-02-04 08:07:18 | ncoghlan | set | messages: + msg311591 |
| 2018-02-03 06:41:25 | miss-islington | set | pull_requests: + pull_request5343 |
| 2018-02-03 06:40:16 | ncoghlan | set | messages: + msg311539 |
| 2018-02-01 16:22:22 | mariocj89 | set | messages: + msg311446 |
| 2018-02-01 16:01:42 | mariocj89 | set | keywords:
+ patch stage: test needed -> patch review pull_requests: + pull_request5302 |
| 2018-02-01 15:25:20 | ncoghlan | set | messages: + msg311439 |
| 2018-02-01 15:19:36 | mariocj89 | set | messages: + msg311437 |
| 2018-01-28 16:17:43 | jaraco | set | messages: + msg310964 |
| 2018-01-28 05:04:51 | ncoghlan | create | |