Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 3ae840500535b1094ecc0561ffd53a076b27344a
      
https://github.com/Perl/perl5/commit/3ae840500535b1094ecc0561ffd53a076b27344a
  Author: Lukas Mai <[email protected]>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    M op.c
    M t/lib/warnings/op

  Log Message:
  -----------
  op.c: don't warn on 'open my $fh, $file;'

We have a hacky heuristic that complains about `Missing parentheses
around "my" list` when it sees `my $x, $y;` or similar, assuming the
programmer intended to declare both variables as local: `my ($x, $y);`.

However, this warning is inappropriate for open/opendir because `open my
$fh, $mode, $file` or `opendir my $dh, $dir` can appear in perfectly
correct code. Detecting this case is not easy because the warning is
generated by inspecting and the tokenizer state and manually reparsing
parts of the input. This commit adds even more hackery and reparsing to
avoid the inappropriate warning.

Fixes #4186.


  Commit: 9041d83d909f14661afa72e52c00652b0fcf8778
      
https://github.com/Perl/perl5/commit/9041d83d909f14661afa72e52c00652b0fcf8778
  Author: Lukas Mai <[email protected]>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    M op.c
    M t/lib/warnings/op

  Log Message:
  -----------
  op.c: don't warn on 'socket my $x, $y', 'accept my $x, $y'

These functions autovivify filehandles, just like open and opendir.


Compare: https://github.com/Perl/perl5/compare/18130018e5fa...9041d83d909f

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to