-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-101531: Handle omitted leading zeroes in mac address on Darwin (#1… #105004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
evgeniiz321
commented
May 26, 2023
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: UUID's _arp_getnode does not account for omitted leading 0's in arp output on Darwin #101531
d7ad703
to
edbb512
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some additional tests as well,
Line 780 in fb02b66
def check_parse_mac(self, aix): |
This needs to be changed to handle more than just 'aix' and 'not aix', as well as adding a new test_parse_mac_macos
method.
Likewise an addition to also test update to deal with the new behaviour (even TBH this should have been done while adding AIX support to the function), just add the a variant that tests with macOS values and settings.
Lib/uuid.py
Outdated
@@ -427,7 +429,7 @@ def _find_mac_near_keyword(command, args, keywords, get_word_index): | |||
if words[i] in keywords: | |||
try: | |||
word = words[get_word_index(i)] | |||
mac = int(word.replace(_MAC_DELIM, b''), 16) | |||
mac = _parse_mac(word) | |||
except (ValueError, IndexError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except (ValueError, IndexError): | |
except IndexError: |
_parse_mac should not raise ValueError
, but returns None
on invalid values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Lib/uuid.py
Outdated
@@ -66,6 +66,8 @@ | |||
if _AIX: | |||
_MAC_DELIM = b'.' | |||
_MAC_OMITS_LEADING_ZEROES = True | |||
if sys.platform in ('darwin', ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if sys.platform in ('darwin', ): | |
if sys.platform == 'darwin': |
Using in
to test the value is not necessary at this moment, can be changed when there is another platform that needs this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
3e4b47d
to
de560d0
Compare
I have made the requested changes; please review again |
Thanks for making the requested changes! @ronaldoussoren: please review the changes made to this pull request. |