• Barry Warsaw's avatar
    bpo-32107 - Better merge of #4494 (#4576) · 9522a218
    Barry Warsaw yazdı
    Improve UUID1 MAC address calculation and related tests.
    
    There are two bits in the MAC address that are relevant to UUID1.  The first is the locally administered vs. universally administered bit (second least significant of the first octet).   Physical network interfaces such as ethernet ports and wireless adapters will always be universally administered, but some interfaces --such as the interface that MacBook Pros communicate with their Touch Bars-- are locally administered.  The former are guaranteed to be globally unique, while the latter are demonstrably *not* globally unique and are in fact the same on every MBP with a Touch Bar.  With this bit is set, the MAC is locally administered; with it unset it is universally administered.
    
    The other bit is the multicast bit (least significant bit of the first octet).  When no other MAC address can be found, RFC 4122 mandates that a random 48-bit number be generated.  This randomly generated number *must* have the multicast bit set.
    
    The improvements in uuid.py include:
    
    * Preferentially return a universally administered MAC address, falling back to a locally administered address if none of the former can be found.
    * Improve several coding style issues, such as adding explicit returns of None, using a more readable bitmask pattern, and assuming that the ultimate fallback, random MAC generation will not fail (and propagating any exception there instead of swallowing them).
    
    Improvements in test_uuid.py include:
    
    * Always testing the calculated MAC for universal administration, unless explicitly disabled (i.e. for the random case), or implicitly disabled due to running in the Travis environment.  Travis test machines have *no* universally administered MAC address at the time of this writing.
    9522a218
Adı
Son kayıt (commit)
Son güncelleme
..
asyncio Loading commit data...
collections Loading commit data...
concurrent Loading commit data...
ctypes Loading commit data...
curses Loading commit data...
dbm Loading commit data...
distutils Loading commit data...
email Loading commit data...
encodings Loading commit data...
ensurepip Loading commit data...
html Loading commit data...
http Loading commit data...
idlelib Loading commit data...
importlib Loading commit data...
json Loading commit data...
lib2to3 Loading commit data...
logging Loading commit data...
msilib Loading commit data...
multiprocessing Loading commit data...
pydoc_data Loading commit data...
site-packages Loading commit data...
sqlite3 Loading commit data...
test Loading commit data...
tkinter Loading commit data...
turtledemo Loading commit data...
unittest Loading commit data...
urllib Loading commit data...
venv Loading commit data...
wsgiref Loading commit data...
xml Loading commit data...
xmlrpc Loading commit data...
__future__.py Loading commit data...
__phello__.foo.py Loading commit data...
_bootlocale.py Loading commit data...
_collections_abc.py Loading commit data...
_compat_pickle.py Loading commit data...
_compression.py Loading commit data...
_dummy_thread.py Loading commit data...
_markupbase.py Loading commit data...
_osx_support.py Loading commit data...
_pydecimal.py Loading commit data...
_pyio.py Loading commit data...
_sitebuiltins.py Loading commit data...
_strptime.py Loading commit data...
_threading_local.py Loading commit data...
_weakrefset.py Loading commit data...
abc.py Loading commit data...
aifc.py Loading commit data...
antigravity.py Loading commit data...
argparse.py Loading commit data...
ast.py Loading commit data...
asynchat.py Loading commit data...
asyncore.py Loading commit data...
base64.py Loading commit data...
bdb.py Loading commit data...
binhex.py Loading commit data...
bisect.py Loading commit data...
bz2.py Loading commit data...
cProfile.py Loading commit data...
calendar.py Loading commit data...
cgi.py Loading commit data...
cgitb.py Loading commit data...
chunk.py Loading commit data...
cmd.py Loading commit data...
code.py Loading commit data...
codecs.py Loading commit data...
codeop.py Loading commit data...
colorsys.py Loading commit data...
compileall.py Loading commit data...
configparser.py Loading commit data...
contextlib.py Loading commit data...
copy.py Loading commit data...
copyreg.py Loading commit data...
crypt.py Loading commit data...
csv.py Loading commit data...
datetime.py Loading commit data...
decimal.py Loading commit data...
difflib.py Loading commit data...
dis.py Loading commit data...
doctest.py Loading commit data...
dummy_threading.py Loading commit data...
enum.py Loading commit data...
filecmp.py Loading commit data...
fileinput.py Loading commit data...
fnmatch.py Loading commit data...
formatter.py Loading commit data...
fractions.py Loading commit data...
ftplib.py Loading commit data...
functools.py Loading commit data...
genericpath.py Loading commit data...
getopt.py Loading commit data...
getpass.py Loading commit data...
gettext.py Loading commit data...
glob.py Loading commit data...
gzip.py Loading commit data...
hashlib.py Loading commit data...
heapq.py Loading commit data...
hmac.py Loading commit data...
imaplib.py Loading commit data...
imghdr.py Loading commit data...
imp.py Loading commit data...
inspect.py Loading commit data...
io.py Loading commit data...
ipaddress.py Loading commit data...
keyword.py Loading commit data...
linecache.py Loading commit data...
locale.py Loading commit data...
lzma.py Loading commit data...
macpath.py Loading commit data...
mailbox.py Loading commit data...
mailcap.py Loading commit data...
mimetypes.py Loading commit data...
modulefinder.py Loading commit data...
netrc.py Loading commit data...
nntplib.py Loading commit data...
ntpath.py Loading commit data...
nturl2path.py Loading commit data...
numbers.py Loading commit data...
opcode.py Loading commit data...
operator.py Loading commit data...
optparse.py Loading commit data...
os.py Loading commit data...
pathlib.py Loading commit data...
pdb.py Loading commit data...
pickle.py Loading commit data...
pickletools.py Loading commit data...
pipes.py Loading commit data...
pkgutil.py Loading commit data...
platform.py Loading commit data...
plistlib.py Loading commit data...
poplib.py Loading commit data...
posixpath.py Loading commit data...
pprint.py Loading commit data...
profile.py Loading commit data...
pstats.py Loading commit data...
pty.py Loading commit data...
py_compile.py Loading commit data...
pyclbr.py Loading commit data...
pydoc.py Loading commit data...
queue.py Loading commit data...
quopri.py Loading commit data...
random.py Loading commit data...
re.py Loading commit data...
reprlib.py Loading commit data...
rlcompleter.py Loading commit data...
runpy.py Loading commit data...
sched.py Loading commit data...
secrets.py Loading commit data...
selectors.py Loading commit data...
shelve.py Loading commit data...
shlex.py Loading commit data...
shutil.py Loading commit data...
signal.py Loading commit data...
site.py Loading commit data...
smtpd.py Loading commit data...
smtplib.py Loading commit data...
sndhdr.py Loading commit data...
socket.py Loading commit data...
socketserver.py Loading commit data...
sre_compile.py Loading commit data...
sre_constants.py Loading commit data...
sre_parse.py Loading commit data...
ssl.py Loading commit data...
stat.py Loading commit data...
statistics.py Loading commit data...
string.py Loading commit data...
stringprep.py Loading commit data...
struct.py Loading commit data...
subprocess.py Loading commit data...
sunau.py Loading commit data...
symbol.py Loading commit data...
symtable.py Loading commit data...
sysconfig.py Loading commit data...
tabnanny.py Loading commit data...
tarfile.py Loading commit data...
telnetlib.py Loading commit data...
tempfile.py Loading commit data...
textwrap.py Loading commit data...
this.py Loading commit data...
threading.py Loading commit data...
timeit.py Loading commit data...
token.py Loading commit data...
tokenize.py Loading commit data...
trace.py Loading commit data...
traceback.py Loading commit data...
tracemalloc.py Loading commit data...
tty.py Loading commit data...
turtle.py Loading commit data...
types.py Loading commit data...
typing.py Loading commit data...
uu.py Loading commit data...
uuid.py Loading commit data...
warnings.py Loading commit data...
wave.py Loading commit data...
weakref.py Loading commit data...
webbrowser.py Loading commit data...
xdrlib.py Loading commit data...
zipapp.py Loading commit data...
zipfile.py Loading commit data...