Branch: refs/heads/yves/restricted_hash_disallow_alias_or_local Home: https://github.com/Perl/perl5 Commit: 2edec63e2549108a9fce22d9a08657fb4f792d68 https://github.com/Perl/perl5/commit/2edec63e2549108a9fce22d9a08657fb4f792d68 Author: Yves Orton <demer...@gmail.com> Date: 2023-03-24 (Fri, 24 Mar 2023)
Changed paths: M dist/Storable/t/downgrade.t M embed.fnc M embed.h M ext/Hash-Util/t/Util.t M hv.c M hv.h M pod/perldiag.pod M pp.c M pp_hot.c M proto.h M t/porting/diag.t Log Message: ----------- pp.c/pp_hot.c - prevent aliasing or localizing read only value in a restricted hash This also teaches t/porting/diag.t to handle hv_notallowed() errors. It does not currently include tests, that can come tomorrow. $ ./perl -Ilib -Mexperimental=refaliasing,declared_refs -le'my %h=(k=>1); Internals::SvREADONLY(%h,1); Internals::SvREADONLY($h{k},1); my $v2=2; local \$h{k} = \$v2' Attempt to alias readonly key "k" in restricted hash at -e line 1. $ ./perl -Ilib -Mexperimental=refaliasing,declared_refs -le'my %h=(k=>1); Internals::SvREADONLY(%h,1); Internals::SvREADONLY($h{k},1); my $v2=2; local $h{k} = $v2' Attempt to localize readonly key "k" in restricted hash at -e line 1.