This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Continue #7041.
[perl5.git] / xsutils.c
index 02fab51..b4161b0 100644 (file)
--- a/xsutils.c
+++ b/xsutils.c
@@ -253,11 +253,9 @@ usage:
 
     rv = ST(0);
     ST(0) = TARG;
-    if (!SvOK(rv)) {
-       ST(0) = &PL_sv_no;
-       XSRETURN(1);
-    }
-    if (!SvROK(rv))
+    if (SvGMAGICAL(rv))
+       mg_get(rv);
+    if (!(SvOK(rv) && SvROK(rv)))
        goto usage;
     sv = SvRV(rv);
     sv_setpv(TARG, sv_reftype(sv, 0));