HomePhabricator

[electrum] fix import of urllib in web.py

Description

[electrum] fix import of urllib in web.py

Summary:
The previous import should not have worked, urllib is just a namespace and does not import other modules under it. I suppose that it works by chance because other modules in Electrum ABC properly import urllibe.parse and urllib.request

The issue can be reproduced by attempting to run the test_util suite on its own:

$ python -m electrumabc.tests.test_util
s.........s.........sEEEEEE..EE...........
======================================================================
ERROR: test_parse_URI_address (__main__.TestUtil)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pierre/dev/bitcoin-abc/electrum/electrumabc/tests/test_util.py", line 165, in test_parse_URI_address
    self._do_test_parse_URI(
  File "/home/pierre/dev/bitcoin-abc/electrum/electrumabc/tests/test_util.py", line 161, in _do_test_parse_URI
    result = parse_URI(uri)
  File "/home/pierre/dev/bitcoin-abc/electrum/electrumabc/web.py", line 248, in parse_URI
    u = urllib.parse.urlparse(uri)
AttributeError: module 'urllib' has no attribute 'parse'

Or simply

$ python -c "import urllib; urllib.parse"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'urllib' has no attribute 'parse'

Test Plan: python -m electrumabc.tests.test_util

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D15233

Details

Provenance
PiRKAuthored on Jan 22 2024, 16:23
PiRKPushed on Jan 23 2024, 07:46
Reviewer
Restricted Project
Differential Revision
D15233: [electrum] fix import of urllib in web.py
Parents
rABCdb058e9c530c: [paybutton spec] Updates to spec
Branches
Unknown
Tags
Unknown