diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 3 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 652f341fb9..6d5047553b 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -2722,6 +2722,9 @@ f_BigDecimal(int argc, VALUE *argv, VALUE self) Real *pv; VALUE obj; + if (argc > 0 && CLASS_OF(argv[0]) == rb_cBigDecimal) { + if (argc == 1 || (argc == 2 && RB_TYPE_P(argv[1], T_HASH))) return argv[0]; + } obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, 0); pv = BigDecimal_new(argc, argv); if (pv == NULL) return Qnil; 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); } |