Title: AttributeError: module 'email.errors' has no attribute 'InvalidHeaderError'. · Issue #93010 · python/cpython · GitHub
Open Graph Title: AttributeError: module 'email.errors' has no attribute 'InvalidHeaderError'. · Issue #93010 · python/cpython
X Title: AttributeError: module 'email.errors' has no attribute 'InvalidHeaderError'. · Issue #93010 · python/cpython
Description: Bug report email._header_value_parser tries to raise errors.InvalidHeaderError, but that does not exist (and as far as I can tell, never did): >>> from email.headerregistry import HeaderRegistry >>> reg = HeaderRegistry() >>> reg('Conten...
Open Graph Description: Bug report email._header_value_parser tries to raise errors.InvalidHeaderError, but that does not exist (and as far as I can tell, never did): >>> from email.headerregistry import HeaderRegistry >>...
X Description: Bug report email._header_value_parser tries to raise errors.InvalidHeaderError, but that does not exist (and as far as I can tell, never did): >>> from email.headerregistry import HeaderRe...
Opengraph URL: https://github.com/python/cpython/issues/93010
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AttributeError: module 'email.errors' has no attribute 'InvalidHeaderError'.","articleBody":"\r\n**Bug report**\r\n\r\n`email._header_value_parser` tries to raise `errors.InvalidHeaderError`, but that does not exist (and as far as I can tell, never did):\r\n\r\n```python\r\n\u003e\u003e\u003e from email.headerregistry import HeaderRegistry\r\n\u003e\u003e\u003e reg = HeaderRegistry()\r\n\u003e\u003e\u003e reg('Content-Disposition', 'attachment; 0*00=\"foo\"')\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/lib/python3.10/email/headerregistry.py\", line 604, in __call__\r\n return self[name](name, value)\r\n File \"/usr/lib/python3.10/email/headerregistry.py\", line 192, in __new__\r\n cls.parse(value, kwds)\r\n File \"/usr/lib/python3.10/email/headerregistry.py\", line 448, in parse\r\n kwds['parse_tree'] = parse_tree = cls.value_parser(value)\r\n File \"/usr/lib/python3.10/email/_header_value_parser.py\", line 2705, in parse_content_disposition_header\r\n disp_header.append(parse_mime_parameters(value[1:]))\r\n File \"/usr/lib/python3.10/email/_header_value_parser.py\", line 2569, in parse_mime_parameters\r\n token, value = get_parameter(value)\r\n File \"/usr/lib/python3.10/email/_header_value_parser.py\", line 2431, in get_parameter\r\n token, value = get_section(value)\r\n File \"/usr/lib/python3.10/email/_header_value_parser.py\", line 2382, in get_section\r\n section.defects.append(errors.InvalidHeaderError(\r\nAttributeError: module 'email.errors' has no attribute 'InvalidHeaderError'. Did you mean: 'InvalidHeaderDefect'?\r\n```\r\n\r\nCode:\r\n\r\nhttps://github.com/python/cpython/blob/d8537580921b2e02f477ff1a8dedcf82c24ef0c2/Lib/email/_header_value_parser.py#L2381-L2383\r\n\r\nThis was added in 97f43c019f3bb8376a3a5f7bc52e97b4c2ed8e16 by @bitdancer pretty much some 10 years ago, and I don't think it ever worked (but nor could I find anyone running into this so far): The git history doesn't know anything about an `email.errors.InvalidHeaderError`.\r\n\r\nFound via [Hypothesis](https://hypothesis.readthedocs.io/en/latest/) while testing my own parsing code - cc @Zac-HD if you want to see another instance of \"the curse of hypothesis\" :wink:\r\n\r\n**Your environment**\r\n\r\n- CPython versions tested on: 3.7.13, 3.8.13, 3.9.13, 3.10.4, 3.11.0b1\r\n- Operating system and architecture: Archlinux, x86_64","author":{"url":"https://github.com/The-Compiler","@type":"Person","name":"The-Compiler"},"datePublished":"2022-05-20T11:10:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/93010/cpython/issues/93010"}
| 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:0ca0f3cc-102f-887f-3c1b-86618075543e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E892:201472:6B055B:9702AE:696A11E6 |
| html-safe-nonce | 587d7d8e181d51929645200c254e6ebfcf9f2f66ff0ce0ee0add80d3389d5d47 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODkyOjIwMTQ3Mjo2QjA1NUI6OTcwMkFFOjY5NkExMUU2IiwidmlzaXRvcl9pZCI6IjE3OTM0MTI2MDE3OTAyMDY0MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 52a451d39e788370ef2b17a69012c53adf59b1baf70220750be1b25cb6a89d2b |
| hovercard-subject-tag | issue:1242994836 |
| 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/93010/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b72745290530c8a2ed56f8de602247736904d878656bbf1f825df9a94a246f18/python/cpython/issues/93010 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b72745290530c8a2ed56f8de602247736904d878656bbf1f825df9a94a246f18/python/cpython/issues/93010 |
| og:image:alt | Bug report email._header_value_parser tries to raise errors.InvalidHeaderError, but that does not exist (and as far as I can tell, never did): >>> from email.headerregistry import HeaderRegistry >>... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | The-Compiler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595 |
| 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 | 7266b2d935baa1c6474b16dd9feaa5ca30607261 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width