Project

General

Profile

Actions

Backport #4446

closed

autoload failure with relative paths

Added by quix (James M. Lawrence) about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
[ruby-core:35375]

Description

=begin
% cat foo.rb
module Foo
end

% cat run.rb
dir = File.dirname(File.expand_path(FILE))
$LOAD_PATH.unshift(dir + '/../' + File.basename(dir))

autoload :Foo, 'foo'
p Foo

% ruby -v run.rb
ruby 1.9.2p180 (2011-02-18 revision 30907) [i386-darwin9.8.0]
/Users/jlawrence/tmp/foo.rb:1: warning: loading in progress, circular require considered harmful - /Users/jlawrence/tmp/foo.rb
from run.rb:5:in <main>' from /Users/jlawrence/tmp/foo.rb:1:in <top (required)>'
/Users/jlawrence/tmp/foo.rb:1:in <top (required)>': uninitialized constant Foo (NameError) from run.rb:5:in '

Commit r30789 on trunk fixes this problem (with no conflicts).

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0