Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Cython / tests / run / inlined_context_manager.pyx
Size: Mime:
# mode: run

cimport cython

@cython.final
cdef class TypedContextManager(object):
    cdef double __enter__(self): # not callable from Python !
        return 2.0
    # FIXME: inline __exit__() as well
    def __exit__(self, exc_type, exc_value, exc_tb):
        return 0

def with_statement():
    """
    >>> with_statement()
    2.0
    """
    with TypedContextManager() as x:
        return x