Title: bpo-32303: Consistency fixes for namespace loaders by warsaw · Pull Request #5481 · python/cpython · GitHub
Open Graph Title: bpo-32303: Consistency fixes for namespace loaders by warsaw · Pull Request #5481 · python/cpython
X Title: bpo-32303: Consistency fixes for namespace loaders by warsaw · Pull Request #5481 · python/cpython
Description: This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages having a valid __loader__ but None for __spec__.loader. This branch fixes it by ensuring that the two attributes start out the same. (As always, a user could change one or the other, and no attempt is made by Python to keep them in sync.) Namespace packages have inconsistent __file__ and __spec__.origin. Here, namespace packages have a __spec__.origin that is the literal string "namespace", and they do not have a __file__ attribute. Not only is this inconsistent, I believe it violates the documentation. The fix here is to set both __spec__.origin and __file__ to None for namespace packages. I suppose it's possible that this will break existing code, but I'd argue that because current behavior runs counter to the documentation and makes no sense given the inconsistencies, it is better to fix them. I propose this change be applied to 3.7 and 3.6, although if you, my friendly reviewer, disagrees about 3.6, we can talk about it! This isn't a security issue to back porting to 3.5 is off the table. https://bugs.python.org/issue32303
Open Graph Description: This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages h...
X Description: This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages h...
Opengraph URL: https://github.com/python/cpython/pull/5481
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4ccc1453-8e17-92c7-7fc7-123ff61bc445 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CF80:179658:738568:AABAD6:6A4E13DF |
| html-safe-nonce | 32e28ff49e2e4b02b919b06a600cd808a70b3afcea3d461941eca1d6e0abd22d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjgwOjE3OTY1ODo3Mzg1Njg6QUFCQUQ2OjZBNEUxM0RGIiwidmlzaXRvcl9pZCI6IjMwMTA5NDMxODM0ODE2MDcxMzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 339d0a7da541e79c3ffad4f3d5ed9225af6557778a781134103846e0a713be30 |
| hovercard-subject-tag | pull_request:166640441 |
| 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/5481/files |
| twitter:image | https://avatars.githubusercontent.com/u/210184?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/210184?s=400&v=4 |
| og:image:alt | This branch actually fixes two inconsistencies for namespace package loaders. Namespace packages have inconsistent __loader__ and __spec__.loader. This inconsistency leads to namespace packages h... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| 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 | ea9187571e3edc5f2780f750631138669441ca50 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width