This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
call AV set magic in list assign
authorDavid Mitchell <davem@iabyn.com>
Fri, 4 Nov 2016 15:42:37 +0000 (15:42 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 4 Nov 2016 16:49:44 +0000 (16:49 +0000)
commit80c1439ffbd799a82c109d650c32e9ecc7a3eb26
treefde5f2ec86aa1dc4d6ba3fa5897d47a23a8d826f
parent8e21c40378fa83db73acbf74b1cb99ac60432ee8
call AV set magic in list assign

RT #129996

Perl used to do this, but I broke it with my recent commit
v5.25.6-78-g8b0c337.

Normally if @a has set magic, then that magic gets called for each
av_store() call; e.g. in @a = (1,2,3), the magic should get called 3
times.

I broke that because I was checking for SVs_RMG rather than SVs_SMG, and
it so happens that no core code sets SVs_SMG on an AV without setting
SVs_RMG too. However, code such as Tk (which use PERL_MAGIC_ext magic),
does.

This commit re-instates the AV behaviour.

Oddly enough, hv_store_ent() etc *don't* call HV set magic. I've added
some tests for that, but marked them TODO because I'm not sure what the
correct behaviour should be.
ext/XS-APItest/APItest.pm
ext/XS-APItest/APItest.xs
ext/XS-APItest/t/magic.t
pp_hot.c