Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
56507c78
Kaydet (Commit)
56507c78
authored
Kas 26, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with
virtual interface. Original patch by Kent Frazier.
üst
a04f4e03
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
+35
-2
test_uuid.py
Lib/test/test_uuid.py
+21
-0
uuid.py
Lib/uuid.py
+10
-2
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_uuid.py
Dosyayı görüntüle @
56507c78
import
unittest
import
unittest
from
test
import
support
import
builtins
import
builtins
import
io
import
os
import
os
import
uuid
import
uuid
...
@@ -356,6 +358,25 @@ class TestUUID(unittest.TestCase):
...
@@ -356,6 +358,25 @@ class TestUUID(unittest.TestCase):
self
.
assertEqual
(
node1
,
node2
)
self
.
assertEqual
(
node1
,
node2
)
def
test_find_mac
(
self
):
data
=
'''
\
fake hwaddr
cscotun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
eth0 Link encap:Ethernet HWaddr 12:34:56:78:90:ab
'''
def
mock_popen
(
cmd
):
return
io
.
StringIO
(
data
)
with
support
.
swap_attr
(
os
,
'popen'
,
mock_popen
):
mac
=
uuid
.
_find_mac
(
command
=
'ifconfig'
,
args
=
''
,
hw_identifiers
=
[
'hwaddr'
],
get_index
=
lambda
x
:
x
+
1
,
)
self
.
assertEqual
(
mac
,
0x1234567890ab
)
@unittest.skipUnless
(
importable
(
'ctypes'
),
'requires ctypes'
)
@unittest.skipUnless
(
importable
(
'ctypes'
),
'requires ctypes'
)
def
test_uuid1
(
self
):
def
test_uuid1
(
self
):
equal
=
self
.
assertEqual
equal
=
self
.
assertEqual
...
...
Lib/uuid.py
Dosyayı görüntüle @
56507c78
...
@@ -327,8 +327,16 @@ def _find_mac(command, args, hw_identifiers, get_index):
...
@@ -327,8 +327,16 @@ def _find_mac(command, args, hw_identifiers, get_index):
words
=
line
.
lower
()
.
split
()
words
=
line
.
lower
()
.
split
()
for
i
in
range
(
len
(
words
)):
for
i
in
range
(
len
(
words
)):
if
words
[
i
]
in
hw_identifiers
:
if
words
[
i
]
in
hw_identifiers
:
return
int
(
try
:
words
[
get_index
(
i
)]
.
replace
(
':'
,
''
),
16
)
return
int
(
words
[
get_index
(
i
)]
.
replace
(
':'
,
''
),
16
)
except
(
ValueError
,
IndexError
):
# Virtual interfaces, such as those provided by
# VPNs, do not have a colon-delimited MAC address
# as expected, but a 16-byte HWAddr separated by
# dashes. These should be ignored in favor of a
# real MAC address
pass
except
IOError
:
except
IOError
:
continue
continue
return
None
return
None
...
...
Misc/ACKS
Dosyayı görüntüle @
56507c78
...
@@ -394,6 +394,7 @@ John Fouhy
...
@@ -394,6 +394,7 @@ John Fouhy
Andrew Francis
Andrew Francis
Stefan Franke
Stefan Franke
Martin Franklin
Martin Franklin
Kent Frazier
Bruce Frederiksen
Bruce Frederiksen
Robin Friedrich
Robin Friedrich
Bradley Froehle
Bradley Froehle
...
...
Misc/NEWS
Dosyayı görüntüle @
56507c78
...
@@ -16,6 +16,9 @@ Core and Builtins
...
@@ -16,6 +16,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with
virtual interface. Original patch by Kent Frazier.
- Issue #11489: JSON decoder now accepts lone surrogates.
- Issue #11489: JSON decoder now accepts lone surrogates.
- Issue #19545: Avoid chained exceptions while passing stray % to
- Issue #19545: Avoid chained exceptions while passing stray % to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment