X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=eventlet%2Feventlet%2Fgreen%2Fbuiltin.py;fp=eventlet%2Feventlet%2Fgreen%2Fbuiltin.py;h=0000000000000000000000000000000000000000;hb=358bd9258c2b6d2ee74de4dfd07a5123107abad4;hp=3dd2c763e90bf1abb2c97af0179f9f1a441cd1fc;hpb=376ff3bfe7071cc0793184a378c4e74508fb0d97;p=packages%2Ftrusty%2Fpython-eventlet.git diff --git a/eventlet/eventlet/green/builtin.py b/eventlet/eventlet/green/builtin.py deleted file mode 100644 index 3dd2c76..0000000 --- a/eventlet/eventlet/green/builtin.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -In order to detect a filehandle that's been closed, our only clue may be -the operating system returning the same filehandle in response to some -other operation. - -The builtins 'file' and 'open' are patched to collaborate with the -notify_opened protocol. -""" - -builtins_orig = __builtins__ - -from eventlet import hubs -from eventlet.hubs import hub -from eventlet.patcher import slurp_properties -import sys - -__all__ = dir(builtins_orig) -__patched__ = ['file', 'open'] - -slurp_properties(builtins_orig, globals(), - ignore=__patched__, srckeys=dir(builtins_orig)) - -hubs.get_hub() - -__original_file = file - - -class file(__original_file): - def __init__(self, *args, **kwargs): - super(file, self).__init__(*args, **kwargs) - hubs.notify_opened(self.fileno()) - -__original_open = open -__opening = False - - -def open(*args): - global __opening - result = __original_open(*args) - if not __opening: - # This is incredibly ugly. 'open' is used under the hood by - # the import process. So, ensure we don't wind up in an - # infinite loop. - __opening = True - hubs.notify_opened(result.fileno()) - __opening = False - return result