Content-Length: 284570 | pFad | https://github.com/python/cpython/issues/127740

32 The error message for odd-length input to `bytes.fromhex` is cryptic · Issue #127740 · python/cpython · GitHub
Skip to content

The error message for odd-length input to bytes.fromhex is cryptic #127740

@Kodiologist

Description

@Kodiologist

Bug report

Bug description:

Python 3.14.0a2+ (main, Dec  8 2024, 10:50:32) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> bytes.fromhex('deadbee')
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    bytes.fromhex('deadbee')
    ~~~~~~~~~~~~~^^^^^^^^^^^
ValueError: non-hexadecimal number found in fromhex() arg at position 7
>>> bytes.fromhex('deadbeef')
b'\xde\xad\xbe\xef'

I suggest: ValueError: fromhex() arg must be of even length.

CPython versions tested on:

3.12, CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/127740

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy