summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-17 01:32:16 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-17 01:32:16 +0000
commit559b717567e61206294a310cdeedea9f28426e22 (patch)
tree325edbd741eeb51db9eb94dcf7c2a1819e2520f9
parent9d5b1a51d60f53adb5f3cc6c9c2344770725c94e (diff)
Merge commit r32994 from trunk:
* rational.c (nurat_coerce): Rational#coerce should converts itself into Complex if the argument is a Complex with non-zero imaginary part. [Bug #5020] [ruby-dev:44088] * test/ruby/test_rational.rb (test_coerce): test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog19
-rw-r--r--rational.c2
-rw-r--r--test/ruby/test_rational.rb4
3 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f385d8051..d5bb1ec979 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Aug 17 10:16:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * backport r32994 from trunk.
+
+ * rational.c (nurat_coerce): Rational#coerce should converts itself
+ into Complex if the argument is a Complex with non-zero imaginary
+ part. [Bug #5020] [ruby-dev:44088]
+
+ * test/ruby/test_rational.rb (test_coerce): test for the above change.
+
Wed Aug 17 06:33:19 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* backport r32992 from trunk.
@@ -30,6 +40,7 @@ Tue Aug 16 09:38:37 2011 Eric Hodel <drbrain@segment7.net>
[Ruby 1.9 - Bug #5192]
* ext/.document (fiddle): Remove duplicate entry
+
* ext/fiddle: Complete documentation of Fiddle. Patch by Vincent
Batts. [#5192]
@@ -45,6 +56,7 @@ Mon Aug 15 10:16:55 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* backport r32973 from trunk.
* ext/openssl/ossl_ssl.c: Support disabling OpenSSL compression.
+
* test/openssl/test_ssl.rb: Add a test for it.
Thanks to Eric Wong for the patch.
[Ruby 1.9 - Feature #5183] [ruby-core:38911]
@@ -72,12 +84,14 @@ Sat Aug 13 09:26:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/core_ext.rb: Make Kernel#y private.
[ruby-core:38913]
+
* test/psych/test_yaml.rb: corresponding test.
Sat Aug 13 09:15:16 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c (date_strftime_alloc): followed the change
of r32885.
+
* NEWS: followed the above change.
Sat Aug 13 08:49:05 2011 Tadayoshi Funaba <tadf@dotrb.org>
@@ -300,6 +314,7 @@ Fri Aug 5 07:35:00 2011 Luis Lavena <luislavena@gmail.com>
* lib/rubygems/installer.rb (class Gem): Correct path check on Windows
Possible fix for [Ruby 1.9 - Bug #5111]
+
* test/rubygems/test_gem_installer.rb (load Gem): ditto
Backported from trunk r32804
@@ -312,7 +327,7 @@ Fri Aug 5 07:00:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
Wed Aug 4 02:35:00 2011 Kenta Murata <mrkn@mrkn.jp>
* configure.in: use build_os variable for checking C and C++ compilers
- matching.
+ matching.
* configure.in: use clang++ if clang is used.
@@ -422,6 +437,7 @@ Sat Jul 30 23:51:44 2011 Tadayoshi Funaba <tadf@dotrb.org>
Sat Jul 30 23:48:04 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c: an issue that is same as [ruby-dev:44071].
+
* ext/date/date_strftime.c: identical to [ruby-dev:44112].
Sat Jul 30 23:19:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
@@ -467,6 +483,7 @@ Sat Jul 30 10:58:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* signal.c (rb_register_sigaltstack): ditto.
* vm_core.h: moved ALT_STACK_SIZE definition from signal.c.
+
* vm.c (thread_free): use xfree() instead of free().
Sat Jul 30 07:20:49 2011 Tanaka Akira <akr@fsij.org>
diff --git a/rational.c b/rational.c
index 8dac978ca7..40b480df6e 100644
--- a/rational.c
+++ b/rational.c
@@ -1108,6 +1108,8 @@ nurat_coerce(VALUE self, VALUE other)
if (k_exact_zero_p(RCOMPLEX(other)->imag))
return rb_assoc_new(f_rational_new_bang1
(CLASS_OF(self), RCOMPLEX(other)->real), self);
+ else
+ return rb_assoc_new(other, rb_Complex(self, INT2FIX(0)));
}
rb_raise(rb_eTypeError, "%s can't be coerced into %s",
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 3d9709517f..70aab03c38 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -721,6 +721,10 @@ class Rational_Test < Test::Unit::TestCase
assert_equal([Rational(2),Rational(1)], Rational(1).coerce(2))
assert_equal([Rational(2.2),Rational(1)], Rational(1).coerce(2.2))
assert_equal([Rational(2),Rational(1)], Rational(1).coerce(Rational(2)))
+
+ assert_nothing_raised(TypeError, '[Bug #5020] [ruby-devl:44088]') do
+ Rational(1,2).coerce(Complex(1,1))
+ end
end
class ObjectX