In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/20e67ba160487a25d00c812a421df80232423b07?hp=f4d8be8b395cdacf05f8c461fb7e9ce0366ff56f>
- Log ----------------------------------------------------------------- commit 20e67ba160487a25d00c812a421df80232423b07 Author: Father Chrysostomos <[email protected]> Date: Tue Aug 16 22:15:01 2016 -0700 Remove dead code in pp.c:pp_index 8df0e7a28b changed /* One needs to be upgraded. */ if (little_utf8) { to /* One needs to be upgraded. */ if (little_utf8 && !IN_ENCODING) { The âelseâ branch of that âifâ has some code conditional on little_utf8 being true, which could only happen before in the case of PL_encoding being set, and which cannot happen any more. M pp.c commit c61c589cfa68dccf52432ac2d8e084ba49a4da14 Author: Father Chrysostomos <[email protected]> Date: Tue Aug 16 11:25:03 2016 -0700 perldelta for #126482 / c82de78e3ba M pod/perldelta.pod commit 9dcfb888e52104c4c92e8c35a6ccfabc6c46e96c Author: Father Chrysostomos <[email protected]> Date: Tue Aug 16 11:22:46 2016 -0700 Test that the lexer does not upgrade constants Make sure that if two barewords occur in a row the lexer does not upgrade the corresponding symbol table entries into full GVs. c82de78e was a bug fix, but it also made things more efficient. Test that we do not lose that efficiency by mistake. M t/base/lex.t commit 89bfd824260d1b31d8f48e0c38e8ad89bf285b4b Author: Father Chrysostomos <[email protected]> Date: Tue Aug 16 11:14:51 2016 -0700 Move a recently-added test Itâs not really a method test (no method call is involved, but a check to see whether the code might compile to a method call), but a lexer test. M t/op/lex.t M t/op/method.t ----------------------------------------------------------------------- Summary of changes: pod/perldelta.pod | 6 ++++++ pp.c | 13 +++---------- t/base/lex.t | 15 ++++++++++++++- t/op/lex.t | 5 ++++- t/op/method.t | 6 +----- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 3a04773..6571d26 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -395,6 +395,12 @@ In 5.25.4 fchown() was changed not to accept negative one as an argument because in some platforms that is an error. However, in some other platforms that is an acceptable argument. This change has been reverted [perl #128967]. +=item * + +Mentioning the same constant twice in a row (which is a syntax error) no +longer fails an assertion under debugging builds. This was a regression +from 5.20. [perl #126482] + =back =head1 Known Problems diff --git a/pp.c b/pp.c index 336122a..124bf63 100644 --- a/pp.c +++ b/pp.c @@ -3544,18 +3544,11 @@ PP(pp_index) sv_usepvn(temp, pv, llen); little_p = SvPVX(little); } else { - temp = little_utf8 - ? newSVpvn(big_p, biglen) : newSVpvn(little_p, llen); + temp = newSVpvn(little_p, llen); sv_utf8_upgrade(temp); - if (little_utf8) { - big = temp; - big_utf8 = TRUE; - big_p = SvPV_const(big, biglen); - } else { - little = temp; - little_p = SvPV_const(little, llen); - } + little = temp; + little_p = SvPV_const(little, llen); } } if (SvGAMAGIC(big)) { diff --git a/t/base/lex.t b/t/base/lex.t index 4ac2b5b..87eb0e4 100644 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -1,6 +1,6 @@ #!./perl -print "1..107\n"; +print "1..109\n"; $x = 'x'; @@ -535,3 +535,16 @@ print qq|ok $test - [perl #128478] "\$foo::\$bar"\n|; $test++; @bar = ("baz","bonk"); print "not " unless "$foo::@bar" eq "barbaz bonk"; print qq|ok $test - [perl #128478] "\$foo::\@bar"\n|; $test ++; + +# Test that compilation of tentative indirect method call syntax which +# turns out not to be such does not upgrade constants to full globs in the +# symbol table. +sub fop() { 0 } +sub bas() { 0 } +{ local $SIG{__WARN__}=sub{}; eval 'fop bas'; } +print "not " unless ref $::{fop} eq 'SCALAR'; +print "ok $test - first constant in 'const1 const2' is not upgraded\n"; +$test++; +print "not " unless ref $::{bas} eq 'SCALAR'; +print "ok $test - second constant in 'const1 const2' is not upgraded\n"; +$test++; diff --git a/t/op/lex.t b/t/op/lex.t index 6c207d7..c0f94c0 100644 --- a/t/op/lex.t +++ b/t/op/lex.t @@ -7,7 +7,7 @@ use warnings; BEGIN { chdir 't' if -d 't'; require './test.pl'; } -plan(tests => 26); +plan(tests => 27); { no warnings 'deprecated'; @@ -217,3 +217,6 @@ fresh_perl_is( {}, 'foo ? require : bar [perl #128307]' ); + +like runperl(prog => 'sub ub(){0} ub ub', stderr=>1), qr/Bareword found/, + '[perl #126482] Assert failure when mentioning a constant twice in a row'; diff --git a/t/op/method.t b/t/op/method.t index 596f869..a9666bb 100644 --- a/t/op/method.t +++ b/t/op/method.t @@ -13,7 +13,7 @@ BEGIN { use strict; no warnings 'once'; -plan(tests => 151); +plan(tests => 150); @A::ISA = 'B'; @B::ISA = 'C'; @@ -704,10 +704,6 @@ SKIP: { "check unknown import() methods don't corrupt the stack"); } -like runperl(prog => 'sub ub(){0} ub ub', stderr=>1), qr/Bareword found/, - '[perl #126482] Assert failure when mentioning a constant twice in a row'; - - __END__ #FF9900 #F78C08 -- Perl5 Master Repository
