[PATCH 1/2] G_{VOID,SCALAR,ARRAY} aren't separate bits anymore with Perl 5.12

Niko Tyni ntyni at debian.org
Thu May 20 08:18:11 UTC 2010


As of

 http://perl5.git.perl.org/perl.git/commit/2f8edad0d37e91319b6ba10b3745327ea49c179b

G_{VOID,SCALAR,ARRAY} aren't really separate bits that can be OR'd together

This is somewhat contradictory to perlcall.pod, and there's no public
interface for checking if G_ARRAY is set in the flags before call_sv(),
so use the undocumented G_WANT mask for now. This works starting with 5.10.1.

It's possible that just comparing for equality with G_ARRAY would do,
as no code path seems to set any other flag bits before calling EvalAll().
I'm not willing to bet on this though, so err to the side of caution.
---
 epeval.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/epeval.c b/epeval.c
index b7ce784..1b7cd17 100644
--- a/epeval.c
+++ b/epeval.c
@@ -350,12 +350,12 @@ static int EvalAll (/*i/o*/ register req * r,
 	sRef = "; \\&" ;
     
     if (r -> Component.bStrict)
-        if (flags & G_ARRAY)
+        if (flags & G_WANT == G_ARRAY)
             pSVCmd = newSVpvf(sFormatStrictArray, r -> Component.sEvalPackage, sName, r -> Component.nSourceline, r -> Component.sSourcefile, sArg, sRef, sName) ;
         else
             pSVCmd = newSVpvf(sFormatStrict, r -> Component.sEvalPackage, sName, r -> Component.nSourceline, r -> Component.sSourcefile, sArg, sRef, sName) ;
     else
-        if (flags & G_ARRAY)
+        if (flags & G_WANT == G_ARRAY)
             pSVCmd = newSVpvf(sFormatArray, r -> Component.sEvalPackage, sName, r -> Component.nSourceline, r -> Component.sSourcefile, sArg, sRef, sName) ;
         else
             pSVCmd = newSVpvf(sFormat, r -> Component.sEvalPackage, sName, r -> Component.nSourceline, r -> Component.sSourcefile, sArg, sRef, sName) ;
-- 
1.7.1


--rwEMma7ioTxnRzrJ
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-Use-SvROK-instead-of-checking-if-SvTYPE-SVt_RV.patch"



More information about the pkg-perl-maintainers mailing list