As of v5.21.6, CvPADLIST() is only legal on pure Perl subroutines.
Nicholas Clark [Sun, 1 Mar 2015 16:07:27 +0000 (17:07 +0100)]
So move the call to padlist_size into the CvISXSUB() else block.

CHANGES
Size.xs

diff --git a/CHANGES b/CHANGES
index de2fc00..3d20bda 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,11 @@ Revision history for Perl extension Devel::Size.
   * handle the multideref op, and to a limited extent the UNOP_AUX op class in
     general. [CPAN #102911]
 
+  * As of eacbb37937698a03 (v5.21.6), can't call CvPADLIST on an XSUB.
+    More usefully, the slot is now used for XS versioning protection, which
+    means that we can be confident that nothing out there is using it for data.
+    Reported as [CPAN #102909].
+
 0.79_51 2015-02-28 nicholas
   * as of 5.20.0, s/// is no longer a reliable test for OOK [CPAN #95493]
 
diff --git a/Size.xs b/Size.xs
index 840a49d..06d150b 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -921,13 +921,15 @@ sv_size(pTHX_ struct state *const st, const SV * const orig_thing,
     sv_size(aTHX_ st, (SV *)CvSTASH(thing), SOME_RECURSION);
     sv_size(aTHX_ st, (SV *)SvSTASH(thing), SOME_RECURSION);
     sv_size(aTHX_ st, (SV *)CvGV(thing), SOME_RECURSION);
-    padlist_size(aTHX_ st, CvPADLIST(thing), SOME_RECURSION);
     sv_size(aTHX_ st, (SV *)CvOUTSIDE(thing), recurse);
     if (CvISXSUB(thing)) {
        sv_size(aTHX_ st, cv_const_sv((CV *)thing), recurse);
-    } else if (CvROOT(thing)) {
-       op_size(aTHX_ CvSTART(thing), st);
-       op_size(aTHX_ CvROOT(thing), st);
+    } else {
+        padlist_size(aTHX_ st, CvPADLIST(thing), SOME_RECURSION);
+        if (CvROOT(thing)) {
+            op_size(aTHX_ CvSTART(thing), st);
+            op_size(aTHX_ CvROOT(thing), st);
+        }
     }
     goto freescalar;