Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(256267)

#11508: Virtual Interfaces cause uuid._find_mac to raise a ValueError under Linux

Can't Edit
Can't Publish+Mail
Start Review
Created:
8 years, 5 months ago by kentfrazier
Modified:
5 years, 9 months ago
Reviewers:
storchaka
CC:
devnull_psf.upfronthosting.co.za, kfrazier, Zach Ware, storchaka
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_uuid.py View 1 chunk +33 lines, -0 lines 3 comments Download
Lib/uuid.py View 1 1 chunk +10 lines, -2 lines 3 comments Download
Misc/ACKS View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3
storchaka_gmail.com
http://bugs.python.org/review/11508/diff/2073/Lib/test/test_uuid.py File Lib/test/test_uuid.py (right): http://bugs.python.org/review/11508/diff/2073/Lib/test/test_uuid.py#newcode368 Lib/test/test_uuid.py:368: class MockPopen(object): I think this can be simpler. def ...
5 years, 10 months ago #1
kfrazier
Thanks for the feedback! By the way, this is my first contribution to CPython, so ...
5 years, 9 months ago #2
storchaka_gmail.com
5 years, 9 months ago #3
http://bugs.python.org/review/11508/diff/2073/Lib/test/test_uuid.py
File Lib/test/test_uuid.py (right):

http://bugs.python.org/review/11508/diff/2073/Lib/test/test_uuid.py#newcode368
Lib/test/test_uuid.py:368: class MockPopen(object):
On 2013/10/31 03:36:29, kfrazier wrote:
> On 2013/10/27 14:09:20, storchaka wrote:
> > I think this can be simpler.
> > 
> > def mock_popen(cmd):
> >     return io.StringIO('...')
> > 
> > with support.swap_attr(os, 'popen', mock_popen):
> >     ...
> 
> I didn't know about support.swap_attr. That is a much nicer way of mocking and
> an improvement for sure. As for the other change to the test case, I think it
> wouldn't work because the code that calls os.popen here is expecting a context
> manager. That is why I had to add the __enter__ and __exit__ support.

io.StringIO supports context manager protocol.

http://bugs.python.org/review/11508/diff/2073/Lib/uuid.py
File Lib/uuid.py (right):

http://bugs.python.org/review/11508/diff/2073/Lib/uuid.py#newcode338
Lib/uuid.py:338: except ValueError:
On 2013/10/31 03:36:29, kfrazier wrote:
> On 2013/10/27 14:09:20, storchaka wrote:
> > Perhaps we should catch IndexError too.
> 
> It might be appropriate to catch it, but I don't know if this bug would cause
an
> IndexError. What sort of conditions do you anticipate resulting in an
IndexError
> here?

If a line ends with 'hwaddr' or 'ether'.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+