def clear_dynamic_scopes(self):
        self._scopes = self._scopes[:self._fixed_scope_end]
        self._references = self._references[:self._fixed_reference_end]
        self._fixed_scope_end = None
        self._fixed_reference_end = None
        self._known_frame_levels = []