Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Sep 28, 2017

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
MemberAuthor

_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
Copy link
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
MemberAuthor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@vstinner@gronke@Mariatta@the-knights-who-say-ni@bedevere-bot