module Bootsnap::CompileCache::YAML::Psych4::Patch

def load_file(path, *args)

def load_file(path, *args)
  return super unless CompileCache::YAML.supported_internal_encoding?
  return super if args.size > 1
  if (kwargs = args.first)
    return super unless kwargs.is_a?(Hash)
    return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty?
  end
  begin
    CompileCache::Native.fetch(
      CompileCache::YAML.cache_dir,
      File.realpath(path),
      CompileCache::YAML::Psych4::SafeLoad,
      kwargs,
    )
  rescue Errno::EACCES
    CompileCache.permission_error(path)
  end
end

def unsafe_load_file(path, *args)

def unsafe_load_file(path, *args)
  return super unless CompileCache::YAML.supported_internal_encoding?
  return super if args.size > 1
  if (kwargs = args.first)
    return super unless kwargs.is_a?(Hash)
    return super unless (kwargs.keys - CompileCache::YAML.supported_options).empty?
  end
  begin
    CompileCache::Native.fetch(
      CompileCache::YAML.cache_dir,
      File.realpath(path),
      CompileCache::YAML::Psych4::UnsafeLoad,
      kwargs,
    )
  rescue Errno::EACCES
    CompileCache.permission_error(path)
  end
end