Skip to content

Commit bb8d1c3

Browse files
ysthkhwilliamson
authored andcommitted
'use 5.41' affects current line source::encoding
Previously it didn't take effect until subsequent lines Fixes #23881
1 parent 3bdb682 commit bb8d1c3

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/source/source_encoding.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ if (fresh_perl_like(<<~'EOT',
4444
EOT
4545
"",
4646
{ }, "source encoding can be turned off");
47+
fresh_perl_like(<<~'EOT',
48+
use v5.41.0; my $var = "¶";
49+
EOT
50+
qr/Use of non-ASCII character 0x[[:xdigit:]]{2} illegal/,
51+
{ }, ">= 'use statement affects rest of current line'");
4752
}
48-
else { # Above test depends on the previous one; if that failed, use this
53+
else { # Above tests depend on the previous one; if that failed, use this
4954
# alternate one
5055
fresh_perl_is(<<~'EOT',
5156
use source::encoding 'ascii';

op.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8477,6 +8477,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
84778477
else {
84788478
PL_hints &= ~HINT_ASCII_ENCODING;
84798479
}
8480+
notify_parser_that_encoding_changed();
84808481

84818482
PL_prevailing_version = shortver;
84828483
}

pod/perldelta.pod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ manager will later use a regex to expand these into links.
366366

367367
=item *
368368

369-
XXX
369+
S<C<use 5.42>> now turns on S<C<use source::encoding "ascii">> for the
370+
remainder of the line (besides subsequent lines). [GH #23881]
370371

371372
=back
372373

0 commit comments

Comments
 (0)