This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients barry, serhiy.storchaka, vstinner
Date 2017-11-23.19:31:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <90E15E6B-3908-4F17-AB0A-EE8C6C8DE159@python.org>
In-reply-to <1511454252.42.0.213398074469.issue32107@psf.upfronthosting.co.za>
Content
On Nov 23, 2017, at 11:24, Serhiy Storchaka <report@bugs.python.org> wrote:

> Wait, now I understand the purpose of the current test! There is just a typo in a comment, should be 41 instead of 47. The test itself is correct. If the address is obtained from network cards, it should have the 41 bit clear. If it is generated randomly, it should have the 41 bit set, to avoid conflicts with addresses obtained from network cards. There is nothing about the 42 bit.

It’s not just a typo in the comment, it’s a typo in the bitmask, at least if the intent of the test is to ensure that the MAC address is universally administered.  That is defined as having a 0 in the “second least significant bit of the first octet”.  Here’s a way to make that clearer.

# Second least significant bit of the first octet of the 48-bit MAC address
>>> 0b00000010_00000000_00000000_00000000_00000000_00000000
2199023255552
# Constant from the PR
>>> 1<<41
2199023255552
# Literal bit mask from the original code.
>>> 0x010000000000
1099511627776

The latter is off by 1 place.
History
Date User Action Args
2017-11-23 19:31:23barrysetrecipients: + barry, vstinner, serhiy.storchaka
2017-11-23 19:31:23barrylinkissue32107 messages
2017-11-23 19:31:23barrycreate