You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
948B

  1. import sys
  2. from eventlet import patcher
  3. from eventlet.green import select
  4. __patched__ = [
  5. 'DefaultSelector',
  6. 'SelectSelector',
  7. ]
  8. # We only have green select so the options are:
  9. # * leave it be and have selectors that block
  10. # * try to pretend the "bad" selectors don't exist
  11. # * replace all with SelectSelector for the price of possibly different
  12. # performance characteristic and missing fileno() method (if someone
  13. # uses it it'll result in a crash, we may want to implement it in the future)
  14. #
  15. # This module used to follow the third approach but just removing the offending
  16. # selectors is less error prone and less confusing approach.
  17. __deleted__ = [
  18. 'PollSelector',
  19. 'EpollSelector',
  20. 'DevpollSelector',
  21. 'KqueueSelector',
  22. ]
  23. patcher.inject('selectors', globals(), ('select', select))
  24. del patcher
  25. if sys.platform != 'win32':
  26. SelectSelector._select = staticmethod(select.select)
  27. DefaultSelector = SelectSelector