Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c23862f

Browse filesBrowse files
miss-islingtoncsanders-gitcorona10
authored
gh-98415: Fix uuid.getnode() ifconfig implementation (GH-98423)
The uuid.getnode() function has multiple implementations, tested sequentially. The ifconfig implementation was incorrect and always failed: fix it. In practice, functions of libuuid library are preferred, if available: uuid_generate_time_safe(), uuid_create() or uuid_generate_time(). (cherry picked from commit e3ec272) Co-authored-by: Chaim Sanders <csanders-git@users.noreply.github.com> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
1 parent e07086d commit c23862f
Copy full SHA for c23862f

File tree

Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed

‎Lib/uuid.py

Copy file name to clipboardExpand all lines: Lib/uuid.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,12 @@ def _get_command_stdout(command, *args):
370370
# for are actually localized, but in theory some system could do so.)
371371
env = dict(os.environ)
372372
env['LC_ALL'] = 'C'
373-
proc = subprocess.Popen((executable,) + args,
373+
# Empty strings will be quoted by popen so we should just ommit it
374+
if args != ('',):
375+
command = (executable, *args)
376+
else:
377+
command = (executable,)
378+
proc = subprocess.Popen(command,
374379
stdout=subprocess.PIPE,
375380
stderr=subprocess.DEVNULL,
376381
env=env)
@@ -510,7 +515,7 @@ def _ifconfig_getnode():
510515
mac = _find_mac_near_keyword('ifconfig', args, keywords, lambda i: i+1)
511516
if mac:
512517
return mac
513-
return None
518+
return None
514519

515520
def _ip_getnode():
516521
"""Get the hardware address on Unix by running ip."""
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix detection of MAC addresses for :mod:`uuid` on certain OSs. Patch by Chaim Sanders

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.