示例#1
0
        def __exit__(self, type, value, traceback):  # noqa: A002
            final_contexts = _state.contexts
            _state.contexts = self.old_contexts

            if final_contexts is not self.new_contexts:
                raise StackContextInconsistentError(
                    "stack_context inconsistency (may be caused by yield "
                    'within a "with TracerStackContext" block)')

            # break the reference to allow faster GC on CPython
            self.new_contexts = None
示例#2
0
    def __exit__(self, type, value, traceback):
        final_contexts = _state.contexts
        _state.contexts = self.old_contexts

        if final_contexts is not self.new_contexts:
            raise StackContextInconsistentError(
                'stack_context inconsistency (may be caused by yield '
                'within a "with StackContext" block)')

        # Break up a reference to itself to allow for faster GC on CPython.
        self.new_contexts = None