Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID wrongly parses hex values with underscores #125651

Open
sevdog opened this issue Oct 17, 2024 · 0 comments
Open

UUID wrongly parses hex values with underscores #125651

sevdog opened this issue Oct 17, 2024 · 0 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@sevdog
Copy link

sevdog commented Oct 17, 2024

Bug report

Bug description:

import uuid
uuid.UUID("123_4567812345678123456781234567")
#  UUID('01234567-8123-4567-8123-456781234567')

UUID parsing hex strings internally uses int method which from Python 3.6 accepts underscores (_) as digit separators

Changed in version 3.6: Grouping digits with underscores as in code literals is allowed.

Since the UUID does not performs sanitization of this character this may result in parsing as valid non-RFC compliant UUID values.

CPython versions tested on:

3.10, CPython main branch

Operating systems tested on:

Linux

Linked PRs

@sevdog sevdog added the type-bug An unexpected behavior, bug, or error label Oct 17, 2024
sevdog added a commit to sevdog/cpython that referenced this issue Oct 17, 2024
@Eclips4 Eclips4 added the stdlib Python modules in the Lib dir label Oct 17, 2024
sevdog added a commit to sevdog/cpython that referenced this issue Oct 18, 2024
sevdog added a commit to sevdog/cpython that referenced this issue Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants