Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: andhapp/ruby
...
head fork: andhapp/ruby
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 6 files changed
  • 0 commit comments
  • 4 contributors
Commits on Jul 31, 2012
@nobu nobu variable.c: fix r36574
* variable.c (classname): tell if found name is permanent.  search
  tmp_classpath only if class id is set.  [ruby-core:42865][Bug #6078]
* variable.c (rb_class_path): duplicate found temporary path.
* variable.c (rb_set_class_path_string, rb_set_class_path): set class
  id to find classpath.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
bc08bdc
@nobu nobu class.c: fix duplication of prepended module
* class.c (include_class_new): fix duplication of prepended module.
  since m_tbl of prepended module is always zero, copy from its
  copy iclass of original.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
b283d01
svn * 2012-08-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
59c1393
@shirosaki shirosaki test_rubyoptions.rb: fix test failure on Windows
* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding):
  Fix test_encoding failure on Windows.
  With chcp 65001, 1252 and 437, test_encoding failed. Test result
  depends on locale because LANG environment variable doesn't affect
  locale on Windows.
  [ruby-core:46872] [Bug #6813]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
f52eefe
Commits on Aug 01, 2012
@andhapp Merge branch 'trunk' of git://github.com/ruby/ruby into trunk 97c912f
View
25 ChangeLog
@@ -1,3 +1,28 @@
+Wed Aug 1 05:50:53 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding):
+ Fix test_encoding failure on Windows.
+ With chcp 65001, 1252 and 437, test_encoding failed. Test result
+ depends on locale because LANG environment variable doesn't affect
+ locale on Windows.
+ [ruby-core:46872] [Bug #6813]
+
+Wed Aug 1 00:33:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (include_class_new): fix duplication of prepended module.
+ since m_tbl of prepended module is always zero, copy from its
+ copy iclass of original.
+
+Tue Jul 31 18:22:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (classname): tell if found name is permanent. search
+ tmp_classpath only if class id is set. [ruby-core:42865][Bug #6078]
+
+ * variable.c (rb_class_path): duplicate found temporary path.
+
+ * variable.c (rb_set_class_path_string, rb_set_class_path): set class
+ id to find classpath.
+
Tue Jul 31 10:36:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych.rb: updated to released version.
View
2  class.c
@@ -636,7 +636,7 @@ include_class_new(VALUE module, VALUE super)
}
RCLASS_IV_TBL(klass) = RCLASS_IV_TBL(module);
RCLASS_CONST_TBL(klass) = RCLASS_CONST_TBL(module);
- RCLASS_M_TBL(klass) = RCLASS_M_TBL(module);
+ RCLASS_M_TBL(klass) = RCLASS_M_TBL(RCLASS_ORIGIN(module));
RCLASS_SUPER(klass) = super;
if (RB_TYPE_P(module, T_ICLASS)) {
RBASIC(klass)->klass = RBASIC(module)->klass;
View
9 test/ruby/test_module.rb
@@ -1356,6 +1356,15 @@ def test_prepend_module_ancestors
assert_equal([:m0, :m1, :m2, :c1], c1.new.x)
assert_equal([c2, m0, m1, m2, c0], c2.ancestors[0, 5], bug6662)
assert_equal([:c2, :m0, :m1, :m2, :c0], c2.new.x)
+
+ m3 = labeled_module("m3") {include m1; prepend m1}
+ assert_equal([m3, m0, m1], m3.ancestors)
+ m3 = labeled_module("m3") {prepend m1; include m1}
+ assert_equal([m0, m1, m3], m3.ancestors)
+ m3 = labeled_module("m3") {prepend m1; prepend m1}
+ assert_equal([m0, m1, m3], m3.ancestors)
+ m3 = labeled_module("m3") {include m1; include m1}
+ assert_equal([m3, m0, m1], m3.ancestors)
end
def labeled_module(name, &block)
View
13 test/ruby/test_rubyoptions.rb
@@ -199,14 +199,21 @@ def test_yydebug
end
def test_encoding
- assert_in_out_err(%w(-Eutf-8), "p '\u3042'", [], /invalid multibyte char/)
-
assert_in_out_err(%w(--encoding), "", [], /missing argument for --encoding/)
assert_in_out_err(%w(--encoding test_ruby_test_rubyoptions_foobarbazqux), "", [],
/unknown encoding name - test_ruby_test_rubyoptions_foobarbazqux \(RuntimeError\)/)
- assert_in_out_err(%w(--encoding utf-8), "p '\u3042'", [], /invalid multibyte char/)
+ if /mswin|mingw/ =~ RUBY_PLATFORM &&
+ (str = "\u3042".force_encoding(Encoding.find("locale"))).valid_encoding?
+ # This result depends on locale because LANG=C doesn't affect locale
+ # on Windows.
+ out, err = [str], []
+ else
+ out, err = [], /invalid multibyte char/
+ end
+ assert_in_out_err(%w(-Eutf-8), "puts '\u3042'", out, err)
+ assert_in_out_err(%w(--encoding utf-8), "puts '\u3042'", out, err)
end
def test_syntax_check
View
54 variable.c
@@ -29,8 +29,11 @@ Init_var_tables(void)
rb_global_tbl = st_init_numtable();
rb_class_tbl = st_init_numtable();
CONST_ID(autoload, "__autoload__");
+ /* __classpath__: fully qualified class path */
CONST_ID(classpath, "__classpath__");
+ /* __tmp_classpath__: temporary class path which contains anonymous names */
CONST_ID(tmp_classpath, "__tmp_classpath__");
+ /* __classid__: name given to class/module under an anonymous namespace */
CONST_ID(classid, "__classid__");
}
@@ -110,6 +113,13 @@ fc_i(st_data_t k, st_data_t v, st_data_t a)
return ST_CONTINUE;
}
+/**
+ * Traverse constant namespace and find +classpath+ for _klass_. If
+ * _preferred_ is not 0, choice the path whose base name is set to it.
+ * If +classpath+ is found, the hidden instance variable __classpath__
+ * is set to the found path, and __tmp_classpath__ is removed.
+ * The path is frozen.
+ */
static VALUE
find_class_path(VALUE klass, ID preferred)
{
@@ -139,33 +149,39 @@ find_class_path(VALUE klass, ID preferred)
return Qnil;
}
+/**
+ * Returns +classpath+ of _klass_, if it is named, or +nil+ for
+ * anonymous +class+/+module+. The last part of named +classpath+ is
+ * never anonymous, but anonymous +class+/+module+ names may be
+ * contained. If the path is "permanent", that means it has no
+ * anonymous names, <code>*permanent</code> is set to 1.
+ */
static VALUE
-classname(VALUE klass)
+classname(VALUE klass, int *permanent)
{
VALUE path = Qnil;
st_data_t n;
if (!klass) klass = rb_cObject;
+ *permanent = 1;
if (RCLASS_IV_TBL(klass)) {
if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)classpath, &n)) {
+ ID cid = 0;
if (st_lookup(RCLASS_IV_TBL(klass), (st_data_t)classid, &n)) {
- path = find_class_path(klass, SYM2ID(n));
+ cid = SYM2ID(n);
+ path = find_class_path(klass, cid);
}
if (NIL_P(path)) {
path = find_class_path(klass, (ID)0);
}
if (NIL_P(path)) {
- if (!st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) {
+ if (!cid || !st_lookup(RCLASS_IV_TBL(klass), (st_data_t)tmp_classpath, &n)) {
return Qnil;
}
- path = rb_str_dup((VALUE)n);
- OBJ_FREEZE(path);
+ *permanent = 0;
+ path = (VALUE)n;
return path;
}
- OBJ_FREEZE(path);
- st_insert(RCLASS_IV_TBL(klass), (st_data_t)classpath, (st_data_t)path);
- n = classid;
- st_delete(RCLASS_IV_TBL(klass), &n, 0);
}
else {
path = (VALUE)n;
@@ -188,7 +204,8 @@ classname(VALUE klass)
VALUE
rb_mod_name(VALUE mod)
{
- VALUE path = classname(mod);
+ int permanent;
+ VALUE path = classname(mod, &permanent);
if (!NIL_P(path)) return rb_str_dup(path);
return path;
@@ -197,11 +214,10 @@ rb_mod_name(VALUE mod)
static VALUE
rb_tmp_class_path(VALUE klass, int *permanent)
{
- VALUE path = classname(klass);
+ VALUE path = classname(klass, permanent);
st_data_t n = (st_data_t)path;
if (!NIL_P(path)) {
- *permanent = 1;
return path;
}
if (RCLASS_IV_TBL(klass) && st_lookup(RCLASS_IV_TBL(klass),
@@ -233,7 +249,9 @@ VALUE
rb_class_path(VALUE klass)
{
int permanent;
- return rb_tmp_class_path(klass, &permanent);
+ VALUE path = rb_tmp_class_path(klass, &permanent);
+ if (!NIL_P(path)) path = rb_str_dup(path);
+ return path;
}
void
@@ -251,7 +269,10 @@ rb_set_class_path_string(VALUE klass, VALUE under, VALUE name)
rb_str_cat2(str, "::");
rb_str_append(str, name);
OBJ_FREEZE(str);
- if (!permanent) pathid = tmp_classpath;
+ if (!permanent) {
+ pathid = tmp_classpath;
+ rb_ivar_set(klass, classid, ID2SYM(rb_intern_str(name)));
+ }
}
rb_ivar_set(klass, pathid, str);
}
@@ -270,7 +291,10 @@ rb_set_class_path(VALUE klass, VALUE under, const char *name)
str = rb_str_dup(rb_tmp_class_path(under, &permanent));
rb_str_cat2(str, "::");
rb_str_cat2(str, name);
- if (!permanent) pathid = tmp_classpath;
+ if (!permanent) {
+ pathid = tmp_classpath;
+ rb_ivar_set(klass, classid, ID2SYM(rb_intern(name)));
+ }
}
OBJ_FREEZE(str);
rb_ivar_set(klass, pathid, str);
View
6 version.h
@@ -1,11 +1,11 @@
#define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2012-07-31"
+#define RUBY_RELEASE_DATE "2012-08-01"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
#define RUBY_RELEASE_YEAR 2012
-#define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 31
+#define RUBY_RELEASE_MONTH 8
+#define RUBY_RELEASE_DAY 1
#include "ruby/version.h"

No commit comments for this range

Something went wrong with that request. Please try again.