In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fd503f5cfcafd1bd5c45f898cce12ece8d1d368a?hp=5a2060e217d73fba807a79202aa876c8b6a8888a>
- Log ----------------------------------------------------------------- commit fd503f5cfcafd1bd5c45f898cce12ece8d1d368a Author: Dagfinn Ilmari Mannsåker <[email protected]> Date: Thu Jun 1 18:16:56 2017 +0100 Make setting ${^ENCODING} to a defined value fatal This has been deprecated since 5.22 and a no-op since 5.26. Remove the now-obsolete t/uni/heavy.t test, which only tested that utf8_heavy.pl didn't fail to load when ${^ENCODING} was set. ----------------------------------------------------------------------- Summary of changes: MANIFEST | 1 - mg.c | 9 ++------- pod/perldelta.pod | 4 ++++ pod/perldiag.pod | 7 ++++--- pod/perlvar.pod | 1 + t/lib/croak/mg | 7 +++++++ t/lib/warnings/gv | 4 ---- t/lib/warnings/mg | 13 ------------- t/op/leaky-magic.t | 5 ++--- t/re/pat_re_eval.t | 15 +-------------- t/uni/heavy.t | 40 ---------------------------------------- 11 files changed, 21 insertions(+), 85 deletions(-) delete mode 100644 t/uni/heavy.t diff --git a/MANIFEST b/MANIFEST index d39f992561..1214581627 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5881,7 +5881,6 @@ t/uni/fold.t See if Unicode folding works t/uni/goto.t See if Unicode goto &sub works t/uni/greek.t See if Unicode in greek works t/uni/gv.t See if Unicode GVs work. -t/uni/heavy.t See if utf8_heavy.pl uses perl that depends on it t/uni/labels.t See if Unicode labels work t/uni/latin2.t See if Unicode in latin2 works t/uni/lex_utf8.t See if Unicode in lexer works diff --git a/mg.c b/mg.c index c66aa0bb13..3a2210d20f 100644 --- a/mg.c +++ b/mg.c @@ -2727,13 +2727,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) # endif #endif } - else { - if (strEQ(mg->mg_ptr + 1, "NCODING") && SvOK(sv)) - if (PL_localizing != 2) { - deprecate_fatal_in("5.28", - "${^ENCODING} is no longer supported"); - } - } + else if (strEQ(mg->mg_ptr + 1, "NCODING") && SvOK(sv)) + Perl_croak(aTHX_ "${^ENCODING} is no longer supported"); break; case '\006': /* ^F */ PL_maxsysfd = SvIV(sv); diff --git a/pod/perldelta.pod b/pod/perldelta.pod index eeb75c8e77..46b0fe0719 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -96,6 +96,10 @@ bitwise string operators Code points over 0xFF do not make sense for bitwise operators. +=head2 Setting C<${^ENCODING}> to a defined value is now illegal + +This has been deprecated since Perl 5.22 and a no-op since Perl 5.26. + =head1 Deprecations XXX Any deprecated features, syntax, modules etc. should be listed here. diff --git a/pod/perldiag.pod b/pod/perldiag.pod index cf9801e177..7e8d827216 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2112,12 +2112,13 @@ unlikely to be what you want. described in L<perlunicode> and L<perlre>. You used C<\p> or C<\P> in a regular expression without specifying the property name. -=item ${^ENCODING} is no longer supported. Its use will be fatal in Perl 5.28 +=item ${^ENCODING} is no longer supported -(D deprecated) The special variable C<${^ENCODING}>, formerly used to implement +(F) The special variable C<${^ENCODING}>, formerly used to implement the C<encoding> pragma, is no longer supported as of Perl 5.26.0. -Setting this variable will become a fatal error in Perl 5.28. +Setting it to anything other than C<undef> is a fatal error as of Perl +5.28. =item entering effective %s failed diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 0bd747184f..9ce9430b6b 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -1990,6 +1990,7 @@ undefines the variable during the scope of execution of the including function. This variable was added in Perl 5.8.2 and removed in 5.26.0. +Setting it to anything other than C<undef> was made fatal in Perl 5.28.0. =item ${^GLOBAL_PHASE} X<${^GLOBAL_PHASE}> diff --git a/t/lib/croak/mg b/t/lib/croak/mg index f136c2c7ac..d2b23b7138 100644 --- a/t/lib/croak/mg +++ b/t/lib/croak/mg @@ -5,3 +5,10 @@ $SIG{_HUNGRY} = \&mmm_pie; warn "Mmm, pie"; EXPECT No such hook: _HUNGRY at - line 2. +######## +# NAME ${^ENCODING} +${^ENCODING} = undef; +{ local ${^ENCODING}; } +${^ENCODING} = 42; +EXPECT +${^ENCODING} is no longer supported at - line 3. diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index c053d7d45d..122e4904e4 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -9,8 +9,6 @@ $a = ${"#"} ; $a = ${"*"} ; - ${^ENCODING} is no longer supported. - Name "main::a" used only once: possible typo Mandatory Warnings ALL TODO @@ -96,10 +94,8 @@ $* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3. # gv.c $a = ${^ENCODING}; $a = ${^E_NCODING}; -${^ENCODING} = 1; ${^E_NCODING} = 1; # We pretend this variable never existed. EXPECT -${^ENCODING} is no longer supported. Its use will be fatal in Perl 5.28 at - line 4. ######## # gv.c use warnings 'syntax' ; diff --git a/t/lib/warnings/mg b/t/lib/warnings/mg index 589db847b2..6c0f3e5ec7 100644 --- a/t/lib/warnings/mg +++ b/t/lib/warnings/mg @@ -79,16 +79,3 @@ Use of uninitialized value $3 in oct at - line 3. use warnings 'uninitialized'; $ENV{FOO} = undef; # should not warn EXPECT -######## -${^ENCODING} = 42; -{ local ${^ENCODING}; } -${^ENCODING} = undef; -{ local ${^ENCODING} = 37; } -no warnings 'deprecated'; -${^ENCODING} = 42; -{ local ${^ENCODING}; } -${^ENCODING} = undef; -{ local ${^ENCODING} = 37; } -EXPECT -${^ENCODING} is no longer supported. Its use will be fatal in Perl 5.28 at - line 1. -${^ENCODING} is no longer supported. Its use will be fatal in Perl 5.28 at - line 4. diff --git a/t/op/leaky-magic.t b/t/op/leaky-magic.t index 92d1c73a00..4ba8c14ce0 100644 --- a/t/op/leaky-magic.t +++ b/t/op/leaky-magic.t @@ -33,9 +33,8 @@ fresh_perl_is use tests 1; # %SIG ok !scalar keys %foo::SIG, "%foo::SIG"; -use tests 4; # rw ${^LETTERS} variables -for(qw< CHILD_ERROR_NATIVE ENCODING UTF8CACHE WARNING_BITS >) { - no warnings 'deprecated'; # ENCODING is deprecated; +use tests 3; # rw ${^LETTERS} variables +for(qw< CHILD_ERROR_NATIVE UTF8CACHE WARNING_BITS >) { my $name = s/./"qq|\\c$&|"/ere; local $$name = 'swit'; diff --git a/t/re/pat_re_eval.t b/t/re/pat_re_eval.t index 6921d38bac..60582abf67 100644 --- a/t/re/pat_re_eval.t +++ b/t/re/pat_re_eval.t @@ -22,7 +22,7 @@ BEGIN { } -plan tests => 533; # Update this when adding/deleting tests. +plan tests => 497; # Update this when adding/deleting tests. run_tests() unless caller; @@ -745,19 +745,6 @@ sub run_tests { use re 'eval'; ok($ss =~ /^$cc/, fmt("code $u->[2]", $ss, $cc)); } - - SKIP: - { - skip("Encode not working on EBCDIC", 1) unless defined $enc; - # Poor man's "use encoding 'ascii'". - # This causes a different code path in S_const_str() - # to be used - no warnings 'deprecated'; - local ${^ENCODING} = $enc; - use warnings 'deprecated'; - use re 'eval'; - ok($ss =~ /^$cc/, fmt("encode $u->[2]", $ss, $cc)); - } } } } diff --git a/t/uni/heavy.t b/t/uni/heavy.t deleted file mode 100644 index ada31403e3..0000000000 --- a/t/uni/heavy.t +++ /dev/null @@ -1,40 +0,0 @@ -#!./perl -w -# tests that utf8_heavy.pl doesn't use anything that prevents it loading -BEGIN { - chdir 't' if -d 't'; - require './test.pl'; - set_up_inc('../lib'); -} - -plan tests => 1; - -# see [perl #126593] -fresh_perl_is(<<'EOP', "", { stderr => 1 }, "doesn't break with \${^ENCODING}"); -no warnings qw(deprecated); -package Foo; -sub cat_decode { - # stolen from Encode.pm - my ( undef, undef, undef, $pos, $trm ) = @_; - my ( $rdst, $rsrc, $rpos ) = \@_[ 1, 2, 3 ]; - use bytes; - if ( ( my $npos = index( $$rsrc, $trm, $pos ) ) >= 0 ) { - $$rdst .= - substr( $$rsrc, $pos, $npos - $pos + length($trm) ); - $$rpos = $npos + length($trm); - return 1; - } - $$rdst .= substr( $$rsrc, $pos ); - $$rpos = length($$rsrc); - return q(); -} - -sub decode { - my (undef, $tmp) = @_; - utf8::decode($tmp); - $tmp; -} - -BEGIN { ${^ENCODING} = bless [], q(Foo) }; - -(my $tmp = q(abc)) =~ tr/abc/123/; -EOP -- Perl5 Master Repository
