def read_file(filename, namespace=None):

    global MODULES
    global MODULES_CHANGED

    module, mod_time = MODULES.get(filename, (None, None))
    if module is None or mod_time != os.stat(filename)[stat.ST_MTIME]:
        logger.debug('parsing module %s' % filename)

        module_factory = ModuleFactory()
        try:
            module = module_factory.from_file(filename, namespace)

            # Add the parsed module to the cache.
            MODULES[filename] = (module, os.stat(filename)[stat.ST_MTIME])
            MODULES_CHANGED = True

        except:
            logger.exception('error parsing file %s' % filename)

    return module
L{threads.deferToThread} executes the function passed, and correctly
dataset/ETHPy150Open enthought/envisage/envisage/developer/code_browser/enclbr.py/read_file--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/test/test_threads.py/DeferredResultTests.test_deferredResult