<commit_before>class Exception
  original_set_backtrace = instance_method(:set_backtrace)
  
  if BetterErrors.binding_of_caller_available?
    define_method :set_backtrace do |*args|
      unless Thread.current[:__better_errors_exception_lock]
        Thread.current[:__better_errors_exception_lock] = true
        begin
          @__better_errors_bindings_stack = binding.callers.drop(1)
        ensure
          Thread.current[:__better_errors_exception_lock] = false
        end
      end
      original_set_backtrace.bind(self).call(*args)
    end
  end
  
  def __better_errors_bindings_stack
    @__better_errors_bindings_stack || []
  end
end<commit_msg>use Module#prepend for Exception monkey patch<commit_after>module BetterErrors
  module CoreExt
    module Exception
      def set_backtrace(*)
        unless Thread.current[:__better_errors_exception_lock]
          Thread.current[:__better_errors_exception_lock] = true
          begin
            @__better_errors_bindings_stack = binding.callers.drop(1)
          ensure
            Thread.current[:__better_errors_exception_lock] = false
          end
        end

        super
      end

      def __better_errors_bindings_stack
        @__better_errors_bindings_stack || []
      end
    end
  end
end

Exception.send(:prepend, BetterErrors::CoreExt::Exception)
{'fraction_non_alphanumeric': 0.06461307287753569, 'fraction_numerical': 0.0015026296018031556, 'mean_word_length': 3.123839009287926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1068881', 'n_tokens_mistral': 397, 'n_tokens_neox': 381, 'n_words': 65}