Use queue.LifoQueue instead of our own implementation
MODIFY
src/urllib3/connectionpool.py
src/urllib3/connectionpool.py
@@ -37,7 +37,6 @@ from .request import RequestMethods
from .response import BaseHTTPResponse, HTTPResponse
from .util.connection import is_connection_dropped
from .util.proxy import connection_requires_http_tunnel
-from .util.queue import LifoQueue
from .util.request import set_file_position
from .util.response import assert_header_parsing
from .util.retry import Retry
@@ -65,7 +64,7 @@ class ConnectionPool:
"""
scheme = None
- QueueCls = LifoQueue
+ QueueCls = queue.LifoQueue
def __init__(self, host, port=None):
if not host:

DELETE
src/urllib3/util/queue.py
-import collections
-import queue
-
-
-class LifoQueue(queue.Queue):
- def _init(self, _):
- self.queue = collections.deque()
-
- def _qsize(self, len=len):
- return len(self.queue)
-
- def _put(self, item):
- self.queue.append(item)
-
- def _get(self):
- return self.queue.pop()

Use queue.LifoQueue instead of our own implementation

Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>