Title: Call to _imp.source_hash with incorrect arguments in (unreachable?) part of SourceLoader.get_code (importlib._bootstrap_external) · Issue #99508 · python/cpython · GitHub
Open Graph Title: Call to _imp.source_hash with incorrect arguments in (unreachable?) part of SourceLoader.get_code (importlib._bootstrap_external) · Issue #99508 · python/cpython
X Title: Call to _imp.source_hash with incorrect arguments in (unreachable?) part of SourceLoader.get_code (importlib._bootstrap_external) · Issue #99508 · python/cpython
Description: Bug report As far as I can tell this line: cpython/Lib/importlib/_bootstrap_external.py Line 1147 in 4e4b13e source_hash = _imp.source_hash(source_bytes) will raise a TypeError and should be a 2 argument form as seen earlier in the same ...
Open Graph Description: Bug report As far as I can tell this line: cpython/Lib/importlib/_bootstrap_external.py Line 1147 in 4e4b13e source_hash = _imp.source_hash(source_bytes) will raise a TypeError and should be a 2 ar...
X Description: Bug report As far as I can tell this line: cpython/Lib/importlib/_bootstrap_external.py Line 1147 in 4e4b13e source_hash = _imp.source_hash(source_bytes) will raise a TypeError and should be a 2 ar...
Opengraph URL: https://github.com/python/cpython/issues/99508
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Call to _imp.source_hash with incorrect arguments in (unreachable?) part of SourceLoader.get_code (importlib._bootstrap_external)","articleBody":"# Bug report\r\n\r\nAs far as I can tell this line:\r\nhttps://github.com/python/cpython/blob/4e4b13e8f6211abbc0d53056da11357756daa314/Lib/importlib/_bootstrap_external.py#L1147-L1147\r\n\r\nwill raise a TypeError and should be a 2 argument form as seen earlier in the same method.\r\n\r\nhttps://github.com/python/cpython/blob/4e4b13e8f6211abbc0d53056da11357756daa314/Lib/importlib/_bootstrap_external.py#L1117-L1120\r\n\r\nHowever, as either `hash_based` is False, `source_hash` has already been generated or the code returns early I don't think this line can be reached. (Maybe if you have a flaky version of get_data that sometimes raises an ImportError/EOFError??).\r\n\r\nExample:\r\n```python3\r\n\u003e\u003e\u003e _imp.source_hash(_RAW_MAGIC_NUMBER, b'')\r\nb's\\x8d\\x9c\\xd5\\xd5\\xe8\\x7fs'\r\n\r\n\u003e\u003e\u003e _imp.source_hash(b'')\r\nTraceback (most recent call last):\r\n File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/code.py\", line 90, in runcode\r\n exec(code, self.locals)\r\n File \"\u003cinput\u003e\", line 1, in \u003cmodule\u003e\r\nTypeError: source_hash() missing required argument 'source' (pos 2)\r\n```\r\n\r\nEdit: Sorry, as I opened the issue from within the source line via 'reference in new issue' I think I accidentally skipped the bug report format that would have given this a label.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-99635\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/DavidCEllis","@type":"Person","name":"DavidCEllis"},"datePublished":"2022-11-15T12:14:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/99508/cpython/issues/99508"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6d610cb8-1dbf-377c-eca9-697cf1e1c178 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDE4:28F768:70AB92:94329C:696B4B6B |
| html-safe-nonce | 42c21d1ea49134fa381e6bebc2ce36e9497b4ca6caaaf3a5b19912e28ae5bc88 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREU0OjI4Rjc2ODo3MEFCOTI6OTQzMjlDOjY5NkI0QjZCIiwidmlzaXRvcl9pZCI6IjM3MDE2NDY3OTMwNzg2ODg2MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a7a41f030ad830eb78a816faf32ba59fe77fba5d18f3a61e3c398b4b7fd9cd46 |
| hovercard-subject-tag | issue:1449688589 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/99508/issue_layout |
| twitter:image | https://opengraph.githubassets.com/06e5991b920141af270f65b740454802291b3ad294580fdf50b26c90ce408a96/python/cpython/issues/99508 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/06e5991b920141af270f65b740454802291b3ad294580fdf50b26c90ce408a96/python/cpython/issues/99508 |
| og:image:alt | Bug report As far as I can tell this line: cpython/Lib/importlib/_bootstrap_external.py Line 1147 in 4e4b13e source_hash = _imp.source_hash(source_bytes) will raise a TypeError and should be a 2 ar... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DavidCEllis |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width