Remove references to 'sys.version_info'

We support Python 3.6 as a minimum now, making these checks no-ops.

Change-Id: Ibaa2cdb7cc27f541aeb778782813354df2911156
This commit is contained in:
dengzhaosen 2021-04-27 15:32:50 +08:00
parent 0cd154c51a
commit aea7627eb0
2 changed files with 3 additions and 6 deletions

View File

@ -197,12 +197,11 @@ class SignalHandler(metaclass=Singleton):
def __setup_signal_interruption(self): def __setup_signal_interruption(self):
"""Set up to do the Right Thing with signals during poll() and sleep(). """Set up to do the Right Thing with signals during poll() and sleep().
For Python 3.5 and later, deal with the changes in PEP 475 that prevent Deal with the changes introduced in PEP 475 that prevent a signal from
a signal from interrupting eventlet's call to poll() or sleep(). interrupting eventlet's call to poll() or sleep().
""" """
select_module = eventlet.patcher.original('select') select_module = eventlet.patcher.original('select')
self.__force_interrupt_on_signal = (sys.version_info >= (3, 5) and self.__force_interrupt_on_signal = hasattr(select_module, 'poll')
hasattr(select_module, 'poll'))
if self.__force_interrupt_on_signal: if self.__force_interrupt_on_signal:
try: try:

View File

@ -476,7 +476,6 @@ class ProcessLauncherTest(base.ServiceBaseTestCase):
m.assert_called_once_with(signal.SIGTERM, 'test') m.assert_called_once_with(signal.SIGTERM, 'test')
signal_handler.clear() signal_handler.clear()
@mock.patch('sys.version_info', (3, 5))
def test_setup_signal_interruption_no_select_poll(self): def test_setup_signal_interruption_no_select_poll(self):
# NOTE(claudiub): SignalHandler is a singleton, which means that it # NOTE(claudiub): SignalHandler is a singleton, which means that it
# might already be initialized. We need to clear to clear the cache # might already be initialized. We need to clear to clear the cache
@ -490,7 +489,6 @@ class ProcessLauncherTest(base.ServiceBaseTestCase):
self.assertFalse( self.assertFalse(
signal_handler._SignalHandler__force_interrupt_on_signal) signal_handler._SignalHandler__force_interrupt_on_signal)
@mock.patch('sys.version_info', (3, 5))
def test_setup_signal_interruption_select_poll(self): def test_setup_signal_interruption_select_poll(self):
# NOTE(claudiub): SignalHandler is a singleton, which means that it # NOTE(claudiub): SignalHandler is a singleton, which means that it
# might already be initialized. We need to clear to clear the cache # might already be initialized. We need to clear to clear the cache