summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2013-03-24 05:58:43 -0300
committerTony Cook <tony@develop-help.com>2013-06-28 14:53:12 +1000
commitfdf416b69a0b2fb8449bc55e1bf521f3b628b511 (patch)
tree7b2d54f3bfd32b9b969c8ec06144753282c96d68 /pad.c
parent8a7bc8629c40af6e31e59098eacf1dfd8eb02414 (diff)
downloadperl-fdf416b69a0b2fb8449bc55e1bf521f3b628b511.tar.gz
pad.c, S_cv_clone: Maintain the utf8-ness of the cloned cv
Because of a missing SvUTF8_on() in cv_clone(), these two were different: use utf8; eval " sub foo ($;\x{30cd});" eval "my sub foo ($;\x{30cd});" Because the lexical version would lose the UTF8 flag in the prototype.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pad.c b/pad.c
index 18440eeb74..15b2656360 100644
--- a/pad.c
+++ b/pad.c
@@ -2150,8 +2150,11 @@ S_cv_clone(pTHX_ CV *proto, CV *cv, CV *outside)
CvSTART(cv) = CvSTART(proto);
CvOUTSIDE_SEQ(cv) = CvOUTSIDE_SEQ(proto);
- if (SvPOK(proto))
+ if (SvPOK(proto)) {
sv_setpvn(MUTABLE_SV(cv), SvPVX_const(proto), SvCUR(proto));
+ if (SvUTF8(proto))
+ SvUTF8_on(MUTABLE_SV(cv));
+ }
if (SvMAGIC(proto))
mg_copy((SV *)proto, (SV *)cv, 0, 0);