Skip to content

Pathname object in $LOAD_PATH causes error (1.7.14) #1936

@junegunn

Description

@junegunn

Since 1.7.14, require throws TypeError when $LOAD_PATH includes Pathname object. I ran into this error while running some legacy code after upgrading JRuby.

> echo 'puts :a' > a.rb

> rvm use jruby-1.7.13
> ruby -rpathname -e '$LOAD_PATH.unshift Pathname.new("."); require "a"'
a

> rvm use jruby-1.7.14
> ruby -rpathname -e '$LOAD_PATH.unshift Pathname.new("."); require "a"'
TypeError: can't convert Pathname into String
  require at org/jruby/RubyKernel.java:1065
  require at /Users/jg/.rvm/rubies/jruby-1.7.14/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
   (root) at -e:1

> rvm use ruby
> ruby -rpathname -e '$LOAD_PATH.unshift Pathname.new("."); require "a"'
a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions