-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
remove deprecated urllib.request.URLopener/FancyURLopener #84850
Comments
The following code crashes with TypeError: URLopener().open("unknown_proxy://test") the expected behavior is an OSError, which is normally raised for unknown protocols. This implementation of directly calling a method called "unknown_proxy" is fragile and was recently the subject of a security issue: https://bugs.python.org/issue35907 (CVE-2019-9948) Would be good to make this more robust. |
I can fix this, but it does not have high priority. |
URLOpener has been deprecated since Python3.3 (https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L1703-L1705) maybe it should just be removed from the codebase? |
I see. Perhaps that is the resolution then. |
It emits a DeprecationWarning since at least Python 3.6, so yes, it's now fine to remove the feature. It's also documented as deprecated in: Maybe we kept it longer than usual because it was common in Python 2.7 to use it, and we tried to keep support for code base compatible with Python 2 and Python 3? I don't know. I'm fine with removing the class in Python 3.10, but IMO it's too late for Python 3.9 (feature freeze is today). |
Does it includes the FancyURLopener? This class is derived from URLopener. Also what needs to be done? |
I tried but failed to remove urllib deprecated functions: see bpo-45084. |
These classes have been deprecated since Python 3.3.
They've been removed in #125739. TODO:
|
|
…lib.request python/cpython#84850 > Remove URLopener and FancyURLopener classes from urllib.request. > They had previously raised DeprecationWarning since Python 3.3. The test failures were: __________________ test_move_items_urllib_request[URLopener] ___________________ item_name = 'URLopener' @pytest.mark.parametrize("item_name", [item.name for item in six._urllib_request_moved_attributes]) def test_move_items_urllib_request(item_name): """Ensure that everything loads correctly.""" assert item_name in dir(six.moves.urllib.request) > getattr(six.moves.urllib.request, item_name) E AttributeError: module 'six.moves.urllib.request' has no attribute 'URLopener' test_six.py:170: AttributeError ________________ test_move_items_urllib_request[FancyURLopener] ________________ item_name = 'FancyURLopener' @pytest.mark.parametrize("item_name", [item.name for item in six._urllib_request_moved_attributes]) def test_move_items_urllib_request(item_name): """Ensure that everything loads correctly.""" assert item_name in dir(six.moves.urllib.request) > getattr(six.moves.urllib.request, item_name) E AttributeError: module 'six.moves.urllib.request' has no attribute 'FancyURLopener' test_six.py:170: AttributeError
…lib.request (#388) python/cpython#84850 > Remove URLopener and FancyURLopener classes from urllib.request. > They had previously raised DeprecationWarning since Python 3.3. The test failures were: __________________ test_move_items_urllib_request[URLopener] ___________________ item_name = 'URLopener' @pytest.mark.parametrize("item_name", [item.name for item in six._urllib_request_moved_attributes]) def test_move_items_urllib_request(item_name): """Ensure that everything loads correctly.""" assert item_name in dir(six.moves.urllib.request) > getattr(six.moves.urllib.request, item_name) E AttributeError: module 'six.moves.urllib.request' has no attribute 'URLopener' test_six.py:170: AttributeError ________________ test_move_items_urllib_request[FancyURLopener] ________________ item_name = 'FancyURLopener' @pytest.mark.parametrize("item_name", [item.name for item in six._urllib_request_moved_attributes]) def test_move_items_urllib_request(item_name): """Ensure that everything loads correctly.""" assert item_name in dir(six.moves.urllib.request) > getattr(six.moves.urllib.request, item_name) E AttributeError: module 'six.moves.urllib.request' has no attribute 'FancyURLopener' test_six.py:170: AttributeError
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
urllib.request.URLopener
andFancyURLopener
#125739[Fancy]URLopener
removal #127032The text was updated successfully, but these errors were encountered: