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
fb56d8f3
Kaydet (Commit)
fb56d8f3
authored
Tem 20, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix test_uuid.py.
Add a note that this module is thread-unsafe. :-(
üst
25d0bd68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
uuid.py
Lib/uuid.py
+5
-4
No files found.
Lib/uuid.py
Dosyayı görüntüle @
fb56d8f3
...
@@ -410,6 +410,7 @@ def _netbios_getnode():
...
@@ -410,6 +410,7 @@ def _netbios_getnode():
# Thanks to Thomas Heller for ctypes and for his help with its use here.
# Thanks to Thomas Heller for ctypes and for his help with its use here.
# If ctypes is available, use it to find system routines for UUID generation.
# If ctypes is available, use it to find system routines for UUID generation.
# XXX This makes the module non-thread-safe!
_uuid_generate_random
=
_uuid_generate_time
=
_UuidCreate
=
None
_uuid_generate_random
=
_uuid_generate_time
=
_UuidCreate
=
None
try
:
try
:
import
ctypes
,
ctypes
.
util
import
ctypes
,
ctypes
.
util
...
@@ -447,12 +448,12 @@ except:
...
@@ -447,12 +448,12 @@ except:
def
_unixdll_getnode
():
def
_unixdll_getnode
():
"""Get the hardware address on Unix using ctypes."""
"""Get the hardware address on Unix using ctypes."""
_uuid_generate_time
(
_buffer
)
_uuid_generate_time
(
_buffer
)
return
UUID
(
bytes
=
_buffer
.
raw
)
.
node
return
UUID
(
bytes
=
bytes_
(
_buffer
.
raw
)
)
.
node
def
_windll_getnode
():
def
_windll_getnode
():
"""Get the hardware address on Windows using ctypes."""
"""Get the hardware address on Windows using ctypes."""
if
_UuidCreate
(
_buffer
)
==
0
:
if
_UuidCreate
(
_buffer
)
==
0
:
return
UUID
(
bytes
=
_buffer
.
raw
)
.
node
return
UUID
(
bytes
=
bytes_
(
_buffer
.
raw
)
)
.
node
def
_random_getnode
():
def
_random_getnode
():
"""Get a random node ID, with eighth bit set as suggested by RFC 4122."""
"""Get a random node ID, with eighth bit set as suggested by RFC 4122."""
...
@@ -500,7 +501,7 @@ def uuid1(node=None, clock_seq=None):
...
@@ -500,7 +501,7 @@ def uuid1(node=None, clock_seq=None):
# use UuidCreate here because its UUIDs don't conform to RFC 4122).
# use UuidCreate here because its UUIDs don't conform to RFC 4122).
if
_uuid_generate_time
and
node
is
clock_seq
is
None
:
if
_uuid_generate_time
and
node
is
clock_seq
is
None
:
_uuid_generate_time
(
_buffer
)
_uuid_generate_time
(
_buffer
)
return
UUID
(
bytes
=
_buffer
.
raw
)
return
UUID
(
bytes
=
bytes_
(
_buffer
.
raw
)
)
global
_last_timestamp
global
_last_timestamp
import
time
import
time
...
@@ -536,7 +537,7 @@ def uuid4():
...
@@ -536,7 +537,7 @@ def uuid4():
# When the system provides a version-4 UUID generator, use it.
# When the system provides a version-4 UUID generator, use it.
if
_uuid_generate_random
:
if
_uuid_generate_random
:
_uuid_generate_random
(
_buffer
)
_uuid_generate_random
(
_buffer
)
return
UUID
(
bytes
=
_buffer
.
raw
)
return
UUID
(
bytes
=
bytes_
(
_buffer
.
raw
)
)
# Otherwise, get randomness from urandom or the 'random' module.
# Otherwise, get randomness from urandom or the 'random' module.
try
:
try
:
...
...
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