-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatalize $* and $# in perl-5.30 #16718
Comments
From @jkeenanIn this commit we implemented a warning, present in perl-5.28, that the ##### Revert "Remove deprecation warnings related to This reverts commit e9b5346. We've decided that instead of leaving ##### In preparation for perl-5.30, we need to fatalize their use and adjusts Thank you very much. |
From @jkeenanSummary of my perl5 (revision 5 version 29 subversion 4) configuration: Characteristics of this binary (from libperl): |
From @jkeenanOn Fri, 12 Oct 2018 15:53:39 GMT, jkeenan@pobox.com wrote:
A draft of an implementation of the fatalization of Please review the patch, particularly with respect to the following: 1. gv.c: Correct usage of Perl_croak; suitability of error message. 2. Tests: a. I took the warnings tests relevant to this issue and found in t/lib/warnings/gv and created a new file, t/lib/croak/gv Was this appropriate? b. There were individual tests in several files which used lib/B/Deparse.t 3. Documentation: So far the only documentation file altered is pod/perldiag.pod. So I have not yet made any edits in, say, pod/perldelta.pod. Please review carefully. If satisfactory, I would like to merge to blead by Thursday, October 17, so that we can get it into the monthly release scheduled for October 20 and then see how much CPAN breakage occurs. Thank you very much. -- |
From @jkeenanblead.133583.diffdiff --git a/MANIFEST b/MANIFEST
index bcfd99c65b..3180dcf3f3 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5422,6 +5422,7 @@ t/lib/common.pl Helper for lib/{warnings,feature}.t
t/lib/commonsense.t See if configuration meets basic needs
t/lib/Count.pm Helper for t/op/method.t
t/lib/croak.t Test calls to Perl_croak() in the C source.
+t/lib/croak/gv Test croak calls from gv.c
t/lib/croak/mg Test croak calls from mg.c
t/lib/croak/op Test croak calls from op.c
t/lib/croak/pp Test croak calls from pp.c
diff --git a/gv.c b/gv.c
index 4f3a272d1f..798c3ae92f 100644
--- a/gv.c
+++ b/gv.c
@@ -2203,12 +2203,10 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
break;
case '*': /* $* */
case '#': /* $# */
- if (sv_type == SVt_PV)
- /* diag_listed_as: $* is no longer supported. Its use will be fatal in Perl 5.30 */
- Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
- "$%c is no longer supported. Its use "
- "will be fatal in Perl 5.30", *name);
- break;
+ if (sv_type == SVt_PV)
+ /* diag_listed_as: $* is no longer supported as of Perl 5.30 */
+ Perl_croak(aTHX_ "$%c is no longer supported as of Perl 5.30", *name);
+ break;
case '\010': /* $^H */
{
HV *const hv = GvHVn(gv);
@@ -2311,11 +2309,8 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
require_tie_mod_s(gv, *name, "Tie::Hash::NamedCapture", 0);
} else if (sv_type == SVt_PV) {
if (*name == '*' || *name == '#') {
- /* diag_listed_as: $# is no longer supported. Its use will be fatal in Perl 5.30 */
- Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
- WARN_SYNTAX),
- "$%c is no longer supported. Its use "
- "will be fatal in Perl 5.30", *name);
+ /* diag_listed_as: $* is no longer supported as of Perl 5.30 */
+ Perl_croak(aTHX_ "$%c is no longer supported as of Perl 5.30", *name);
}
}
if (sv_type==SVt_PV || sv_type==SVt_PVGV) {
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index 2451ce5e77..d5f830fcd7 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -1718,11 +1718,6 @@ my @x;
@x = ($#{<}, $#{.}, $#{>}, $#{/}, $#{?}, $#{=}, $#+, $#{\}, $#{|}, $#-);
@x = ($#{;}, $#{:}, $#{1}), $#_;
####
-# ${#} interpolated
-# It's a known TODO that warnings are deparsed as bits, not textually.
-no warnings;
-() = "${#}a";
-####
# [perl #86060] $( $| $) in regexps need braces
/${(}/;
/${|}/;
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 4a50e5d9d8..afac8798f8 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -3231,10 +3231,10 @@ code.
You specified a character that has the given plainer way of writing it, and
which is also portable to platforms running with different character sets.
-=item $* is no longer supported. Its use will be fatal in Perl 5.30
+=item $* is no longer supported as of Perl 5.30
-(D deprecated, syntax) The special variable C<$*>, deprecated in older
-perls, has been removed as of 5.10.0 and is no longer supported. In
+(F) The special variable C<$*>, deprecated in older perls, was removed in
+5.10.0, is no longer supported and is a fatal error as of Perl 5.30. In
previous versions of perl the use of C<$*> enabled or disabled multi-line
matching within a string.
@@ -3245,14 +3245,12 @@ then all regular expressions behaved as if they were written using C</m>.)
Use of this variable will be a fatal error in Perl 5.30.
-=item $# is no longer supported. Its use will be fatal in Perl 5.30
+=item $# is no longer supported as of Perl 5.30
-(D deprecated, syntax) The special variable C<$#>, deprecated in older
-perls, has been removed as of 5.10.0 and is no longer supported. You
+(F) The special variable C<$#>, deprecated in older perls, was removed as of
+5.10.0, is no longer supported and is a fatal error as of Perl 5.30. You
should use the printf/sprintf functions instead.
-Use of this variable will be a fatal error in Perl 5.30.
-
=item '%s' is not a code reference
(W overload) The second (fourth, sixth, ...) argument of
diff --git a/t/lib/croak/gv b/t/lib/croak/gv
new file mode 100644
index 0000000000..dabc099570
--- /dev/null
+++ b/t/lib/croak/gv
@@ -0,0 +1,71 @@
+__END__
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$a = ${"#"};
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as of Perl 5.30 [RT #133583]
+$a = ${"*"};
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$a = ${#};
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as of Perl 5.30 [RT #133583]
+$a = ${*};
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$a = $#;
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as of Perl 5.30 [RT #133583]
+$a = $*;
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$# = $a;
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as of Perl 5.30 [RT #133583]
+$* = $a;
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$a = \$#;
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as of Perl 5.30 [RT #133583]
+$a = \$*;
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$a = \$#;
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as of Perl 5.30 [RT #133583]
+$a = $*;
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $# is no longer supported as of Perl 5.30 [RT #133583]
+$a = $#;
+EXPECT
+$# is no longer supported as of Perl 5.30 at - line 1.
+########
+# NAME $* is no longer supported as
8000
of Perl 5.30 [RT #133583]
+$a = $*;
+EXPECT
+$* is no longer supported as of Perl 5.30 at - line 1.
diff --git a/t/lib/warnings/2use b/t/lib/warnings/2use
index a02505eff1..4df98e2baa 100644
--- a/t/lib/warnings/2use
+++ b/t/lib/warnings/2use
@@ -359,21 +359,3 @@ EXPECT
Reversed += operator at - line 6.
Use of uninitialized value $c in scalar chop at - line 9.
########
-
-# Check that deprecation warnings are not implicitly disabled by use
-$*;
-use warnings "void";
-$#;
-EXPECT
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
-Useless use of a variable in void context at - line 5.
-########
-
-# Check that deprecation warnings are not implicitly disabled by no
-$*;
-no warnings "void";
-$#;
-EXPECT
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv
index 122e4904e4..2a2dcf4547 100644
--- a/t/lib/warnings/gv
+++ b/t/lib/warnings/gv
@@ -3,12 +3,6 @@
Can't locate package %s for @%s::ISA
@ISA = qw(Fred); joe()
- $# is no longer supported
- $* is no longer supported
-
- $a = ${"#"} ;
- $a = ${"*"} ;
-
Name "main::a" used only once: possible typo
Mandatory Warnings ALL TODO
@@ -32,66 +26,6 @@ EXPECT
Undefined subroutine &main::joe called at - line 3.
########
# gv.c
-$a = ${"#"};
-$a = ${"*"};
-no warnings 'deprecated' ;
-$a = ${"#"};
-$a = ${"*"};
-EXPECT
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
-########
-# gv.c
-$a = ${#};
-$a = ${*};
-no warnings 'deprecated' ;
-$a = ${#};
-$a = ${*};
-EXPECT
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
-########
-# gv.c
-$a = $#;
-$a = $*;
-$# = $a;
-$* = $a;
-$a = \$#;
-$a = \$*;
-no warnings 'deprecated' ;
-$a = $#;
-$a = $*;
-$# = $a;
-$* = $a;
-$a = \$#;
-$a = \$*;
-EXPECT
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 4.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 6.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 7.
-########
-# gv.c
-@a = @#;
-@a = @*;
-$a = $#;
-$a = $*;
-EXPECT
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 4.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
-########
-# gv.c
-$a = $#;
-$a = $*;
-@a = @#;
-@a = @*;
-EXPECT
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
-$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
-########
-# gv.c
$a = ${^ENCODING};
$a = ${^E_NCODING};
${^E_NCODING} = 1; # We pretend this variable never existed.
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index c770e9cb2c..45cdba528f 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -1030,6 +1030,7 @@ Operator or semicolon missing before *foo at - line 8.
Ambiguous use of * resolved as operator * at - line 8.
Operator or semicolon missing before *foo at - line 10.
Ambiguous use of * resolved as operator * at - line 10.
+$* is no longer supported as of Perl 5.30 at - line 14.
########
# toke.c
$^W = 0 ;
diff --git a/t/op/heredoc.t b/t/op/heredoc.t
index 7b11852e05..ca044a3a83 100644
--- a/t/op/heredoc.t
+++ b/t/op/heredoc.t
@@ -109,7 +109,7 @@ HEREDOC
# [perl #125540] this asserted or crashed
fresh_perl_like(
- q(map d$#<<<<""),
+ q(map d<<<<""),
qr/Can't find string terminator "" anywhere before EOF at - line 1\./,
{},
"Don't assert parsing a here-doc if we hit EOF early"
diff --git a/t/op/lex.t b/t/op/lex.t
index 90be519524..e78fad2c42 100644
--- a/t/op/lex.t
+++ b/t/op/lex.t
@@ -276,10 +276,7 @@ SKIP:
fresh_perl_is(
"stat\tt\$#0",
<<'EOM',
-$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 1.
-Number found where operator expected at - line 1, near "$#0"
- (Missing operator before 0?)
-Can't call method "t" on an undefined value at - line 1.
+$# is no longer supported as of Perl 5.30 at - line 1.
EOM
{},
"[perl #129273] heap use after free or overflow"
diff --git a/t/op/postfixderef.t b/t/op/postfixderef.t
index c2983cf6dd..4125fc2fc7 100644
--- a/t/op/postfixderef.t
+++ b/t/op/postfixderef.t
@@ -16,7 +16,7 @@ BEGIN {
use strict qw(refs subs);
-plan(130);
+plan(128);
{
no strict 'refs';
@@ -326,13 +326,6 @@ is "@foo", "1 2 3 4 5 6 7 8 9", 'lvalue ->$#*';
$_ = "foo";
@foo = 7..9;
%foo = qw( foo oof );
-{
- no warnings 'deprecated';
- $* = 42;
- is "$_->$*", 'foo->42', '->$* interpolation without feature';
- $# = 43;
- is "$_->$#*", 'foo->43*', '->$#* interpolation without feature';
-}
is "$_->@*", 'foo->@*', '->@* does not interpolate without feature';
is "$_->@[0]", 'foo->@[0]', '->@[ does not interpolate without feature';
is "$_->@{foo}", "foo->7 8 9", '->@{ does not interpolate without feature';
diff --git a/t/uni/variables.t b/t/uni/variables.t
index 852ecaab0c..d8709a62b7 100644
--- a/t/uni/variables.t
+++ b/t/uni/variables.t
@@ -14,7 +14,7 @@ use utf8;
use open qw( :utf8 :std );
no warnings qw(misc reserved);
-plan (tests => 66892);
+plan (tests => 66880);
# ${single:colon} should not be treated as a simple variable, but as a
# block with a label inside.
@@ -134,6 +134,7 @@ for ( 0x0 .. 0xff ) {
$tests++;
}
elsif ($chr =~ /[[:punct:][:digit:]]/a) {
+ next if ($chr eq '#' or $chr eq '*'); # RT 133583
# Unlike other variables, we dare not try setting the length-1
# variables that are ASCII punctuation and digits. This is
|
The RT System itself - Status changed from 'new' to 'open' |
From @karenetheridgeI skimmed the patch and it looked reasonable. perlvar.pod will also need to get updated. |
@karenetheridge - Status changed from 'open' to 'resolved' |
From @jkeenanOn Sun, 14 Oct 2018 03:50:52 GMT, ether wrote:
Thanks for the review! (I'll keep the RT open until I actually merge.) Anyone else? -- |
@jkeenan - Status changed from 'resolved' to 'open' |
@jkeenan - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been Perl 5.30.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133583 (status was 'resolved')
Searchable as RT133583$
The text was updated successfully, but these errors were encountered: