develooper Front page | perl.perl5.changes | Postings from March 2023

[Perl/perl5] b571f3: pp.c - forbid localizing and aliasing readonlyhas...

Yves Orton via perl5-changes
March 25, 2023 19:33
[Perl/perl5] b571f3: pp.c - forbid localizing and aliasing readonlyhas...
Message ID:
  Branch: refs/heads/yves/restricted_hash_disallow_alias_or_local
  Commit: b571f323d1720029a816732ac03b399f075e4452
  Author: Yves Orton <>
  Date:   2023-03-25 (Sat, 25 Mar 2023)

  Changed paths:
    M embed.fnc
    M hv.c
    M hv.h
    M pod/perldiag.pod
    M pp.c
    M pp_hot.c
    M proto.h
    M t/op/lvref.t

  Log Message:
  pp.c - forbid localizing and aliasing readonly hash keys in restricted hashes

local $hash{key} and \$hash{key} = \$var are both conceptually modify
operations which are forbidden when the hash is restricted and the value
is readonly. Unfortunately prior to this commit they were still allowed
operations. This patch corrects that oversight.

Adds a bunch of tests to t/op/lvref.t to ensure that it is illegal to
localize or ref-alias a readonly value in a restricted hash. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About