# File lib/rubygems/specification.rb, line 535
  def self.load file
    return unless file && File.file?(file)

    file = file.dup.untaint

    code = if defined? Encoding
             File.read file, :mode => 'r:UTF-8:-'
           else
             File.read file
           end

    code.untaint

    begin
      spec = eval code, binding, file

      if Gem::Specification === spec
        spec.loaded_from = file.to_s
        return spec
      end

      warn "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
    rescue SignalException, SystemExit
      raise
    rescue SyntaxError, Exception => e
      warn "Invalid gemspec in [#{file}]: #{e}"
    end

    nil
  end