GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — email: ValueError in get_section when parsing header with non-ASCII digit · Issue #87112 · python/cpython

email: ValueError in get_section when parsing header with non-ASCII digit #87112

New issue
Copy link
New issue
Copy link
Open
Open
email: ValueError in get_section when parsing header with non-ASCII digit#87112
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

The-Compiler
mannequin
opened on Jan 17, 2021
Issue body actions
BPO 42946
Nosy @warsaw, @bitdancer, @maxking, @The-Compiler

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-01-17.17:14:51.665>
labels = ['type-bug', '3.8', '3.9', '3.10', '3.7', 'library']
title = 'email: ValueError in get_section when parsing header with non-ASCII digit'
updated_at = <Date 2021-01-17.17:14:51.665>
user = 'https://github.com/The-Compiler'

bugs.python.org fields:

activity = <Date 2021-01-17.17:14:51.665>
actor = 'The Compiler'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2021-01-17.17:14:51.665>
creator = 'The Compiler'
dependencies = []
files = []
hgrepos = []
issue_num = 42946
keywords = []
message_count = 1.0
messages = ['385162']
nosy_count = 4.0
nosy_names = ['barry', 'r.david.murray', 'maxking', 'The Compiler']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue42946'
versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

Linked PRs

  • gh-87112: Ensure that only digits convertible to integers are accepted as section number in MIME header parameter #136877

Activity

  1. The-Compiler commented on Jan 17, 2021

    @The-Compiler
    The-Compilermannequin
    on Jan 17, 2021
    MannequinAuthor
    More actions

    Found mostly by accident:

    >>> import email.headerregistry
    >>> reg = email.headerregistry.HeaderRegistry()
    >>> h = reg('Content-Disposition', 'inline; 0*²')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.10/email/headerregistry.py", line 608, in __call__
        return self[name](name, value)
      File "/usr/lib/python3.10/email/headerregistry.py", line 196, in __new__
        cls.parse(value, kwds)
      File "/usr/lib/python3.10/email/headerregistry.py", line 452, in parse
        kwds['parse_tree'] = parse_tree = cls.value_parser(value)
      File "/usr/lib/python3.10/email/_header_value_parser.py", line 2705, in parse_content_disposition_header
        disp_header.append(parse_mime_parameters(value[1:]))
      File "/usr/lib/python3.10/email/_header_value_parser.py", line 2569, in parse_mime_parameters
        token, value = get_parameter(value)
      File "/usr/lib/python3.10/email/_header_value_parser.py", line 2431, in get_parameter
        token, value = get_section(value)
      File "/usr/lib/python3.10/email/_header_value_parser.py", line 2384, in get_section
        section.number = int(digits)
    ValueError: invalid literal for int() with base 10: '²'

    This probably happens because:

    >>> '²'.isdigit()
    True
    >>> int('²')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: invalid literal for int() with base 10: '²'
  2. The-Compiler
    added
    3.7 (EOL)end of lifeend of life
    3.8 (EOL)end of lifeend of life
    3.9 (EOL)end of lifeend of life
    3.10 (EOL)end of lifeend of life
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jan 17, 2021
  3. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  4. serhiy-storchaka
    added
    topic-email
    on May 21, 2022
  5. The-Compiler
    added a commit that references this issue on Jun 16, 2022

    Fix coverage pragmas for Content-Disposition parsing

    9cc91a0
  6. StanFromIreland
    removed
    3.10 (EOL)end of lifeend of life
    3.9 (EOL)end of lifeend of life
    3.8 (EOL)end of lifeend of life
    3.7 (EOL)end of lifeend of life
    on Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.