1. Denis Bilenko
  2. gevent
  3. Pull requests

Pull requests

#11 Open
Repository
northisup
Branch
default
Repository
denis
Branch
default

Added monkey.is_module_patched and monkey.are_modules_patched functions.

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update default
hg pull -r a93ac141278f https://bitbucket.org/northisup/gevent
hg merge a93ac141278f
hg commit -m 'Merged in northisup/gevent (pull request #11)'
Author
  1. northisup
Reviewers
Description

In commit patches to libraries that aren't gevent compatible I found myself wanting an "is_module_patched" function.

I was using something like this:

try:
    from gevent.thread import Thread
except:
    from threading import Thread

But I ran into issues when gevent.thread was available, but the module was not getting monkey patched. What I would prefer is something like...

try:
    from gevent.monkey import is_module_patched
except:
    is_module_patched = lambda x: False

if is_module_patched("thread"):
    # do my special thing
else:
    # do the normal thing
  • Learn about pull requests

Comments (1)

  1. northisup author

    wow, bitbucket doesn't format like github at all...

    In commit patches to libraries that aren't gevent compatible I found myself wanting an "is_module_patched" function.

    I was using something like this:

    try:
        from gevent.thread import Thread
    except:
        from threading import Thread
    

    But I ran into issues when gevent.thread was available, but the module was not getting monkey patched. What I would prefer is something like...

    try:
        from gevent.monkey import is_module_patched
    except:
        is_module_patched = lambda x: False
    
    if is_module_patched("thread"):
        # do my special thing
        pass
    else:
        # do the normal thing
        pass