Change 32748 by [EMAIL PROTECTED] on 2007/12/27 21:41:03

        scalars used in postponed subexpressions aren't first class regexps,
        so don't upgrade them to ORANGE before attaching qr magic.
        (And don't stop using qr magic once regexps become first class)

Affected files ...

... //depot/perl/regexec.c#551 edit
... //depot/perl/t/op/pat.t#298 edit

Differences ...

==== //depot/perl/regexec.c#551 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#550~32742~   2007-12-27 09:22:06.000000000 -0800
+++ perl/regexec.c      2007-12-27 13:41:03.000000000 -0800
@@ -3741,7 +3741,9 @@
                        if (!(SvFLAGS(ret)
                              & (SVs_TEMP | SVs_PADTMP | SVf_READONLY
                                 | SVs_GMG))) {
-                           SvUPGRADE(ret, SVt_ORANGE);
+                           /* This isn't a first class regexp. Instead, it's
+                              caching a regexp onto an existing, Perl visible
+                              scalar.  */
                            sv_magic(ret,(SV*)ReREFCNT_inc(re),
                                        PERL_MAGIC_qr,0,0);
                        }

==== //depot/perl/t/op/pat.t#298 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#297~32747~  2007-12-27 13:34:22.000000000 -0800
+++ perl/t/op/pat.t     2007-12-27 13:41:03.000000000 -0800
@@ -4512,6 +4512,12 @@
     }
 }
 
+{
+    my $a = 3; "" =~ /(??{ $a })/;
+    my $b = $a;
+    iseq($b, $a, "copy of scalar used for postponed subexpression");
+}
+
 # Test counter is at bottom of file. Put new tests above here.
 #-------------------------------------------------------------------
 # Keep the following tests last -- they may crash perl
@@ -4570,6 +4576,6 @@
 iseq(0+$::test,$::TestCount,"Got the right number of tests!");
 # Don't forget to update this!
 BEGIN {
-    $::TestCount = 4013;
+    $::TestCount = 4014;
     print "1..$::TestCount\n";
 }
End of Patch.

Reply via email to