Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Please don't import eventlet even if it's available #854

Open
@gjcarneiro

Description

@gjcarneiro

This code has two problems:

try:
    import eventlet
    try:
        from eventlet.green import urllib2 as eventlet_urllib2
    except ImportError:
        from eventlet.green.urllib import request as eventlet_urllib2
    has_eventlet = True
except:
    has_eventlet = False
  1. Bare except: is evil, please catch a specific exception, ImportError in this case.
  2. I am trying to get rid of eventlet in my code base, and so I have an assertion in my code: assert 'eventlet' not in sys.modules. Unconditionally importing eventlet makes it fail that assertion. Instead, could you please get the module only if it's already imported? if 'eventlet' in sys.modules: stuff.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions