aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--file.c3
-rw-r--r--io.c3
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 14add27220..84cb439ab5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sun Dec 9 12:18:19 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_get_path): use the original object if to_path method is
+ not defined. [ruby-dev:32473]
+
+ * io.c (rb_f_open): call to_open on non-string objects, instead of
+ to_str. [ruby-dev:32473]
+
Sun Dec 9 12:12:23 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (tr_find): returns true if no characters to be removed is
diff --git a/file.c b/file.c
index 09be42415a..ac7ee25a57 100644
--- a/file.c
+++ b/file.c
@@ -111,6 +111,9 @@ rb_get_path(VALUE obj)
if (rb_respond_to(obj, to_path)) {
tmp = rb_funcall(obj, to_path, 0, 0);
}
+ else {
+ tmp = obj;
+ }
exit:
StringValueCStr(tmp);
if (obj != tmp) {
diff --git a/io.c b/io.c
index 12d4e01c59..8a0a7de2a2 100644
--- a/io.c
+++ b/io.c
@@ -3799,7 +3799,8 @@ rb_f_open(int argc, VALUE *argv)
redirect = Qtrue;
}
else {
- VALUE tmp = rb_check_string_type(argv[0]);
+ VALUE tmp = argv[0];
+ FilePathValue(tmp);
if (NIL_P(tmp)) {
redirect = Qtrue;
}