Skip to content

bpo-11063: Create _uuid1 submodule - #3795

Closed
vstinner wants to merge 3 commits into
python:masterfrom
vstinner:uuid1
Closed

vstinner wants to merge 3 commits into
python:masterfrom
vstinner:uuid1

Conversation

@vstinner

@vstinner vstinner commented Sep 28, 2017 •

Copy link
Copy Markdown
Member

uuid module: move getnode() and uuid1() implementations to a new
_uuid1 submodule which is now loaded on demand to reduce side effects
on "import uuid".

https://bugs.python.org/issue11063

uuid module: move getnode() and uuid1() implementations to a new
_uuid1 submodule which is now loaded on demand to reduce side effects
on "import uuid".
@vstinner

Copy link
Copy Markdown
Member Author

_unixdll_getnode() and _windll_getnode() functions used UUID(bytes=bytes).node to convert bytes to a UUID object, then to get the node. I added a new "def _bytes_to_node(rawbytes):" helper function to break the dependency from _uuid1 to the uuid.UUID class. IMHO _bytes_to_node() is simple enough to justify the "duplication" of the code.

@gronke

gronke commented Sep 28, 2017

Copy link
Copy Markdown
Contributor

@Haypo have you noticed #3684 ? You're addressing a similar problem and your comment's are welcome! Personally I don't see a benefit from breaking uuid in two separate files. Instead we could move all code paths involved in uuid1() together. I'll comment on the other PR why we didn't.

@vstinner

Copy link
Copy Markdown
Member Author

Abandonned in favor of @pitrou's PR #3796.

@vstinner vstinner closed this Sep 28, 2017
@vstinner
vstinner deleted the uuid1 branch September 28, 2017 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants