This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
96e5746
)
hash assign in list context should copy key as well
author
Ruslan Zakirov
<ruz@bestpractical.com>
Mon, 8 Oct 2012 18:50:50 +0000
(22:50 +0400)
committer
Father Chrysostomos
<sprout@cpan.org>
Tue, 11 Dec 2012 16:59:40 +0000
(08:59 -0800)
if we don't then returned keys are aliases for RHS
values and can result in unexpected changes
pp_hot.c
patch
|
blob
|
blame
|
history
diff --git
a/pp_hot.c
b/pp_hot.c
index
54f1eec
..
47b3a7b
100644
(file)
--- a/
pp_hot.c
+++ b/
pp_hot.c
@@
-1086,7
+1086,7
@@
PP(pp_aassign)
while (relem < lastrelem) { /* gobble up all the rest */
HE *didstore;
ODD:
- sv = *relem ? *relem : &PL_sv_no;
+ sv = *relem ?
gimme == G_ARRAY ? sv_mortalcopy(*relem) :
*relem : &PL_sv_no;
relem++;
tmpstr = sv_newmortal();
if (*relem)