summaryrefslogtreecommitdiff
path: root/ext/pathname/pathname.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pathname/pathname.c')
-rw-r--r--ext/pathname/pathname.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index 70f82583a1..1cf0f90b9f 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -1323,6 +1323,8 @@ path_unlink(VALUE self)
static VALUE
path_f_pathname(VALUE self, VALUE str)
{
+ if (CLASS_OF(str) == rb_cPathname)
+ return str;
return rb_class_new_instance(1, &str, rb_cPathname);
}