Skip to content

Commit 5d62050

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 fecc1c5 commit 5d62050

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
@@ -8487,6 +8487,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
84878487
else {
84888488
PL_hints &= ~HINT_ASCII_ENCODING;
84898489
}
8490+
notify_parser_that_encoding_changed();
84908491

84918492
PL_prevailing_version = shortver;
84928493
}

pod/perldelta.pod

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

382382
=item *
383383

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

386387
=back
387388

0 commit comments

Comments
 (0)