summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--bootstraptest/test_class.rb6
-rw-r--r--variable.c23
-rw-r--r--version.h2
4 files changed, 27 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index afb49566b7..e4ad5578dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 15 15:15:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_autoload_load): checks if iv_tbl is valid.
+ [ruby-dev:38456]
+
Sat May 16 09:19:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (magic_comment_encoding): use rb_compile_warning() to
diff --git a/bootstraptest/test_class.rb b/bootstraptest/test_class.rb
index ad2844106f..a7f6d4df47 100644
--- a/bootstraptest/test_class.rb
+++ b/bootstraptest/test_class.rb
@@ -144,3 +144,9 @@ assert_equal '3', %q{
}
$i
}
+
+assert_match /::C\z/, %q{
+ c = nil
+ Module.new{|m| c = class m::C; name; end}
+ c
+}, '[ruby-dev:38456]'
diff --git a/variable.c b/variable.c
index 8b4acc8c7c..5ce48ca872 100644
--- a/variable.c
+++ b/variable.c
@@ -1430,11 +1430,23 @@ autoload_node(VALUE mod, ID id, int noload)
return 0;
}
+static NODE *
+autoload_node_ptr(VALUE mod, ID id)
+{
+ struct st_table *tbl = RCLASS_IV_TBL(mod);
+ st_data_t val;
+
+ if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) {
+ return 0;
+ }
+ return autoload_node(mod, id, 0);
+}
+
VALUE
rb_autoload_load(VALUE klass, ID id)
{
VALUE file;
- NODE *load = autoload_node(klass, id, 0);
+ NODE *load = autoload_node_ptr(klass, id);
if (!load) return Qfalse;
file = load->nd_lit;
@@ -1444,15 +1456,10 @@ rb_autoload_load(VALUE klass, ID id)
VALUE
rb_autoload_p(VALUE mod, ID id)
{
- struct st_table *tbl = RCLASS_IV_TBL(mod);
- st_data_t val;
- NODE *load;
VALUE file;
+ NODE *load = autoload_node_ptr(mod, id);
- if (!tbl || !st_lookup(tbl, id, &val) || val != Qundef) {
- return Qnil;
- }
- load = autoload_node(mod, id, 0);
+ if (!load) return Qnil;
return load && (file = load->nd_lit) ? file : Qnil;
}
diff --git a/version.h b/version.h
index aba88b849f..9f9a20b6cd 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "1.9.1"
#define RUBY_RELEASE_DATE "2009-05-12"
-#define RUBY_PATCHLEVEL 140
+#define RUBY_PATCHLEVEL 141
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1