Skip to content

fix: accept raw UUID strings as --namespace argument in uuid CLI (gh-148740)#148936

Closed
Jah-yee wants to merge 2667 commits intopython:mainfrom
Jah-yee:fix/uuid-cli-namespace
Closed

fix: accept raw UUID strings as --namespace argument in uuid CLI (gh-148740)#148936
Jah-yee wants to merge 2667 commits intopython:mainfrom
Jah-yee:fix/uuid-cli-namespace

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Apr 23, 2026

Good day

Fixes gh-148740.

The uuid CLI module (python -m uuid) did not accept raw UUID strings as the --namespace argument for uuid5/uuid3 commands, even though the Python API uuid.uuid5(uuid.UUID(...), name) does.

Change

  • Adds a custom _namespace_type argparse type that accepts either a predefined namespace name (@dns, @url, @oid, @x500) or a raw UUID string
  • Example now works: python -m uuid --uuid uuid5 --namespace 0d6a16cc-34a7-47d8-b660-214d0ae184d2 --name some.user

Before

python -m uuid --uuid uuid5 --namespace 0d6a16cc-34a7-47d8-b660-214d0ae184d2 --name some.user
# error: invalid choice (must be a predefined name)

After

python -m uuid --uuid uuid5 --namespace 0d6a16cc-34a7-47d8-b660-214d0ae184d2 --name some.user
a32f4562-2058-5b20-8055-5f38b28285b6

Thank you for your work on this project. I hope this small fix is helpful. Please let me know if there's anything to adjust.

Warmly,
RoomWithRoof

mdickinson and others added 30 commits February 26, 2023 12:34
…1826) (python#102150)

* [3.10] pythongh-97786: Fix compiler warnings in pytime.c (pythonGH-101826)

Fixes compiler warnings in pytime.c..
(cherry picked from commit b1b375e)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>

* Add comment about the casts

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
…onGH-102278)

[doc] Improve grammar/fix missing word (pythonGH-102060)
(cherry picked from commit 6daf42b)

Co-authored-by: VMan <vayidm@users.noreply.github.com>
…ython#102280)

Fix missing 'is' in cmath.log() docstring.
(cherry picked from commit 71f614e)

Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
…2283)

(cherry picked from commit 8d0f09b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 101a12c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
pythonGH-102297)

(cherry picked from commit 0db6f44)

Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com>
Automerge-Triggered-By: GH:AlexWaygood
Refactor DynOptionMenu's initializer to not copy  kwargs dict and use subscripting;
improve its htest.

(cherry picked from commit c41af81)

Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…honGH-101319) (python#102322)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Brad Wolfe <brad.wolfe@gmail.com>
Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Fix erroneous doc links in the sys module (python#101319)
…hon#102377)

Fix typos in documentation and comments (pythonGH-102374)

Found some duplicate `to`s in the documentation and some code comments and fixed them.

[Misc/NEWS.d/3.12.0a1.rst](https://github.com/python/cpython/blob/ed55c69ebd74178115cd8b080f7f8e7588cd5fda/Misc/NEWS.d/3.12.0a1.rst) also contains two duplicate `to`s, but I wasn't sure if it's ok to touch that file.  Looks auto generated.  I'm happy to amend the PR if requested. :)

Automerge-Triggered-By: GH:AlexWaygood

Co-authored-by: Michael K <michael-k@users.noreply.github.com>
…to uppercase (pythonGH-101840)

(cherry picked from commit 4e7c0cb)

Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
… state… (python#102235)

[3.10] pythonGH-102126: fix deadlock at shutdown when clearing thread states (pythonGH-102222).
(cherry picked from commit 5f11478)
…ll exhausts the iterator (pythonGH-101896) (python#102422)

pythongh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (python#101896)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
(cherry picked from commit 705487c)

Co-authored-by: Raj <51259329+workingpayload@users.noreply.github.com>
pythonGH-102180) (python#102419)

* pythongh-102179: Fix `os.dup2` error reporting for negative fds (pythonGH-102180)
(cherry picked from commit c2bd55d)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit e4609cb)

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>
…nGH-102426)

Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters.
(cherry picked from commit 66aa78c)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
…ument of add_argument() were dropped (pythonGH-102318)

(cherry picked from commit 9a478be)

Co-authored-by: Yeojin Kim <yeojin.dev@gmail.com>
As part of investigation issue python#102433, I discovered what I believe to be an error where two classes `CI` and `DI` are not being used. The assertions beneath them act on `C` and `D`, duplicating existing assertions in this test.
(cherry picked from commit 7894bbe)

Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Automerge-Triggered-By: GH:AlexWaygood
(cherry picked from commit 3222054)

Co-authored-by: Partha P. Mukherjee <ppm.floss@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…1989)

(cherry picked from commit d959bcd)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
…pythongh-102485) (pythonGH-102489)

(cherry picked from commit f9cdeb7)

Co-authored-by: Ned Deily <nad@python.org>
…ndling (pythonGH-102399) (python#102527)

pythonGH-102397: Fix segfault from race condition in signal handling (pythonGH-102399)
(cherry picked from commit 1a84cc0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
pythonGH-102526)

(cherry picked from commit 1f557f9)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
…ith `isinstance()` checks on `typing.runtime_checkable` protocols (pythonGH-102449)

(cherry picked from commit 5ffdaf7)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
…st (pythonGH-102538)

It is possible but unlikely for the `python_tzpath_context` function to fail between the start of the `try` block and the point where `os.environ.get` succeeds, in which case `old_env` will be undefined. In this case, we want to take no action.

Practically speaking this will really only happen in an error condition anyway, so it doesn't really matter, but we should probably do it right anyway.
(cherry picked from commit 64bde50)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
)

(cherry picked from commit 78e4e6c)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 9a8b66b)

Co-authored-by: 谭九鼎 <109224573@qq.com>
…lost after longlist (python#101674) (python#102633)

pythonGH-101673: Fix pdb bug where local variable changes are lost after longlist (python#101674)

(cherry picked from commit 5d677c5)

Co-authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
(cherry-picked from commit f6ca71a)

With grep utility found some duplicated words

Co-authored-by: Виталий Дмитриев <vitaldmit@bk.ru>
hartwork and others added 24 commits November 25, 2025 15:25
CVE-2025-59375) (pythonGH-139234) (python#139532)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…Headers

pythongh-143916: Reject control characters in wsgiref.headers.Headers  (pythonGH-143917)

* Add 'test.support' fixture for C0 control characters
* pythongh-143916: Reject control characters in wsgiref.headers.Headers

(cherry picked from commit f7fceed)
(cherry picked from commit 22e4d55)

Co-authored-by: Seth Michael Larson <seth@python.org>
…ypes (python#144115)

(cherry picked from commit f25509e)
(cherry picked from commit 2c9c746)
…thon#144094)

(cherry picked from commit 95746b3)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
…ator (python#144180)

pythongh-144125: email: verify headers are sound in BytesGenerator
(cherry picked from commit 052e55e)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
Co-authored-by: Denis Ledoux <5822488+beledouxdenis@users.noreply.github.com>
Co-authored-by: Petr Viktorin <302922+encukou@users.noreply.github.com>
Co-authored-by: Bas Bloemsaat <1586868+basbloemsaat@users.noreply.github.com>
…ial of service in http.server (pythonGH-142216) (python#142299)

[3.14] pythongh-119452: Fix a potential virtual memory allocation denial of service in http.server (pythonGH-142216)

The CGI server on Windows could consume the amount of memory specified
in the Content-Length header of the request even if the client does not
send such much data. Now it reads the POST request body by chunks,
therefore the memory consumption is proportional to the amount of sent
data.
(cherry picked from commit 0e4f4f1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…earing (pythonGH-142146) (python#142213)

* pythongh-142145: Remove quadratic behavior in node ID cache clearing (pythonGH-142146)

* Remove quadratic behavior in node ID cache clearing

Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>

* Add news fragment

---------
(cherry picked from commit 08d8e18)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>

* [3.14] pythongh-142754: Ensure that Element & Attr instances have the ownerDocument attribute (pythonGH-142794) (python#142818)

pythongh-142754: Ensure that Element & Attr instances have the ownerDocument attribute (pythonGH-142794)
(cherry picked from commit 1cc7551)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

* pythongh-142145: relax the no-longer-quadratic test timing (pythonGH-143030)

* pythongh-142145: relax the no-longer-quadratic test timing

* require cpu resource
(cherry picked from commit 8d2d7bb)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>

* merge NEWS entries into one

---------

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
…ent (pythonGH-119454) (python#142142)

pythongh-119451: Fix a potential denial of service in http.client (pythonGH-119454)

Reading the whole body of the HTTP response could cause OOM if
the Content-Length value is too large even if the server does not send
a large amount of data. Now the HTTP client reads large data by chunks,
therefore the amount of consumed memory is proportional to the amount
of sent data.
(cherry picked from commit 5a4c4a0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ssage._parseparam` (pythonGH-136072) (python#140831)

pythongh-136063: fix quadratic-complexity parsing in `email.message._parseparam` (pythonGH-136072)
(cherry picked from commit 680a5d0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…nprefix

pythongh-74453: Add stronger security warning to os.path.commonprefix (pythonGH-144401)
(cherry picked from commit 4e15b8d)

Co-authored-by: Seth Michael Larson <seth@python.org>
pythongh-144484: Warn users not to use wsgiref in production
(cherry picked from commit 7e777c5)

Co-authored-by: Seth Michael Larson <seth@python.org>
…onGH-145359) (python#145407)

pythongh-100538: Add workflow to verify bundled libexpat (pythonGH-145359)

Add workflow to verify bundled libexpat.
(cherry picked from commit c9a5d9a)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
…pythonGH-119343) (python#142151)

Reading a specially prepared small Plist file could cause OOM because file's
read(n) preallocates a bytes object for reading the specified amount of
data. Now plistlib reads large data by chunks, therefore the upper limit of
consumed memory is proportional to the size of the input file.
(cherry picked from commit 694922c)
…() fails (pythonGH-144843) (python#144862)

pythongh-144833: Fix use-after-free in SSL module when SSL_new() fails (pythonGH-144843)

In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.

Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638c)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
…45140)

pythongh-143916: Allow HTAB in wsgiref header values
(cherry picked from commit 66da7bf)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
…ythonGH-143936) (python#144350)

Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.
(cherry picked from commit 17d1490)

Co-authored-by: Seth Michael Larson seth@python.org
Co-authored-by: Denis Ledoux dle@odoo.com

- Issue: Fix folding of long comments of unfoldable characters in email headers python#143935

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Co-authored-by: Seth Michael Larson <seth@python.org>
…ommands (pythonGH-145457) (python#145489)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@python-cla-bot
Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@ZeroIntensity
Copy link
Copy Markdown
Member

Please fix your fork before opening another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix UUID's CLI for custom namespaces for v3/v5