summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-21 12:29:12 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-21 12:29:12 -0800
commitcb1f05e8fe9a1c7a7e2de8048f1404df951311b0 (patch)
tree1e0379edd15719969f7492938c3b792f7f95824b /hv.c
parentfd20f1ec3b10f199361e00cffbe2406c485843fb (diff)
downloadperl-cb1f05e8fe9a1c7a7e2de8048f1404df951311b0.tar.gz
Copy hints from tied hh to inner compile scopes
Entries from a tied %^H were not being copied to inner compile-time scopes, resulting in %^H appearing empty in BEGIN blocks, even though the underlying he chain *was* being propagated properly (so (caller)[10] at run time still worked. I was surprised that, in writing tests for this, I produced another crash. I thought I had fixed them with 95cf23680 and 7ef9d42ce. It turns out that pp_helem doesn’t support hashes with null values. (That’s a separate bug that needs fixing, since the XS API allows for them.) For now, cloning the hh properly stops pp_helem from getting a null value.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hv.c b/hv.c
index 28ddcd0d67..7d5843811e 100644
--- a/hv.c
+++ b/hv.c
@@ -1450,7 +1450,7 @@ Perl_hv_copy_hints_hv(pTHX_ HV *const ohv)
{
HV * const hv = newHV();
- if (ohv && HvTOTALKEYS(ohv)) {
+ if (ohv) {
STRLEN hv_max = HvMAX(ohv);
STRLEN hv_fill = HvFILL(ohv);
HE *entry;
@@ -1463,7 +1463,7 @@ Perl_hv_copy_hints_hv(pTHX_ HV *const ohv)
hv_iterinit(ohv);
while ((entry = hv_iternext_flags(ohv, 0))) {
- SV *const sv = newSVsv(HeVAL(entry));
+ SV *const sv = newSVsv(hv_iterval(ohv,entry));
SV *heksv = HeSVKEY(entry);
if (!heksv && sv) heksv = newSVhek(HeKEY_hek(entry));
if (sv) sv_magic(sv, NULL, PERL_MAGIC_hintselem,