-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)
Description
Feature or enhancement
Proposal:
I noticed that we create a new selector in _readline every time
can we use it as an attr? I searched the code base
we reuse it in asyncio selector_envets.py
code:
class BaseSelectorEventLoop(base_events.BaseEventLoop):
"""Selector event loop.
See events.EventLoop for API specification.
"""
def __init__(self, selector=None):
super().__init__()
if selector is None:
selector = selectors.DefaultSelector()
logger.debug('Using selector: %s', selector.__class__.__name__)
self._selector = selector
self._make_self_pipe()
self._transports = weakref.WeakValueDictionary()in pdb.py
def _readline(self):
if self.sigint_received:
# There's a pending unhandled SIGINT. Handle it now.
self.sigint_received = False
raise KeyboardInterrupt
# Wait for either a SIGINT or a line or EOF from the PDB server.
selector = selectors.DefaultSelector()
selector.register(self.signal_read, selectors.EVENT_READ)
selector.register(self.server_socket, selectors.EVENT_READ)Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
msmojtabafar
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-refactorCode refactoring (with no changes in behavior)Code refactoring (with no changes in behavior)