Title: [3.7] bpo-37409: fix relative import with no parent (GH-14956) (GH-15913) by miss-islington · Pull Request #15925 · python/cpython · GitHub
Open Graph Title: [3.7] bpo-37409: fix relative import with no parent (GH-14956) (GH-15913) by miss-islington · Pull Request #15925 · python/cpython
X Title: [3.7] bpo-37409: fix relative import with no parent (GH-14956) (GH-15913) by miss-islington · Pull Request #15925 · python/cpython
Description: Relative imports use resolve_name to get the absolute target name, which first seeks the current module's absolute package name from the globals: If package (and spec.parent) are missing then import uses name, truncating the last segment if the module is a submodule rather than a package init.py (which it guesses from whether path is defined). The name attempt should fail if there is no parent package (top level modules), if name is 'main' (-m entry points), or both (scripts). That is, if both name has no subcomponents and the module does not seem to be a package init module then import should fail.. (cherry picked from commit 92420b3) Co-authored-by: Ben Lewis benjimin@users.noreply.github.com (cherry picked from commit 0a6693a) Co-authored-by: Brett Cannon 54418+brettcannon@users.noreply.github.com https://bugs.python.org/issue37409 Automerge-Triggered-By: @brettcannon
Open Graph Description: Relative imports use resolve_name to get the absolute target name, which first seeks the current module's absolute package name from the globals: If package (and spec.parent) are missing then i...
X Description: Relative imports use resolve_name to get the absolute target name, which first seeks the current module's absolute package name from the globals: If package (and spec.parent) are missing th...
Opengraph URL: https://github.com/python/cpython/pull/15925
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:01c32d97-b8d1-309e-a202-5f4ea9f246ae |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | ED2E:3ABA21:F74A82:14B818F:6A56B973 |
| html-safe-nonce | 98d9c7e5ef40fb70e05e0c03b84057c162cd8580e3dbbb137f3eeedd5f004701 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDJFOjNBQkEyMTpGNzRBODI6MTRCODE4Rjo2QTU2Qjk3MyIsInZpc2l0b3JfaWQiOiIzMDgyMDIzNjMzODA1NTU2MDgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 604f05f470fc7636f859679e2058cefc440aec14746bbdcad4a7c8940ab856f9 |
| hovercard-subject-tag | pull_request:316404382 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/15925/files |
| twitter:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| og:image:alt | Relative imports use resolve_name to get the absolute target name, which first seeks the current module's absolute package name from the globals: If package (and spec.parent) are missing then i... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | df99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c29ba03b1896083dbe1084f6cd1c5367d8a0d67c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width