summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2017-08-05 08:00:32 -0500
committerCraig A. Berry <craigberry@mac.com>2017-08-05 08:00:32 -0500
commit61084eefd823e097255934e8ab599c0e418e5253 (patch)
tree9047dd9507be896648efbeaeba1de5a649d396a5 /hv.c
parent400ffcff649c80c7986e4790a425796a250f2d97 (diff)
downloadperl-61084eefd823e097255934e8ab599c0e418e5253.tar.gz
Consider magic %ENV as tied in hv_pushkv.
For the DYNAMIC_ENV_FETCH case, we don't know the number of keys until the first iteration triggers a call to prime_env_iter(), so piggyback on the tied magic case, which already handles extending the stack for each iteration rather than all at once beforehand.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hv.c b/hv.c
index 20b4eceb98..7029e28387 100644
--- a/hv.c
+++ b/hv.c
@@ -988,7 +988,11 @@ void
Perl_hv_pushkv(pTHX_ HV *hv, U32 flags)
{
HE *entry;
- bool tied = SvRMAGICAL(hv) && mg_find(MUTABLE_SV(hv), PERL_MAGIC_tied);
+ bool tied = SvRMAGICAL(hv) && (mg_find(MUTABLE_SV(hv), PERL_MAGIC_tied)
+#ifdef DYNAMIC_ENV_FETCH /* might not know number of keys yet */
+ || mg_find(MUTABLE_SV(hv), PERL_MAGIC_env)
+#endif
+ );
dSP;
PERL_ARGS_ASSERT_HV_PUSHKV;