summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_ctl.c5
-rw-r--r--t/op/inccode.t16
2 files changed, 18 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index c8c67736b0..7236921455 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3833,12 +3833,13 @@ PP(pp_require)
tryname = SvPVX_const(namesv);
tryrsfp = NULL;
- ENTER_with_name("call_INC");
- SAVETMPS;
if (SvPADTMP(nsv)) {
nsv = sv_newmortal();
SvSetSV_nosteal(nsv,sv);
}
+
+ ENTER_with_name("call_INC");
+ SAVETMPS;
EXTEND(SP, 2);
PUSHMARK(SP);
diff --git a/t/op/inccode.t b/t/op/inccode.t
index b00959c67c..0712956f3e 100644
--- a/t/op/inccode.t
+++ b/t/op/inccode.t
@@ -21,7 +21,7 @@ unless (is_miniperl()) {
use strict;
-plan(tests => 61 + !is_miniperl() * (3 + 14 * $can_fork));
+plan(tests => 62 + !is_miniperl() * (3 + 14 * $can_fork));
sub get_temp_fh {
my $f = tempfile();
@@ -267,6 +267,20 @@ is $_||$@, "are temps freed prematurely?",
"are temps freed prematurely when returned from inc filters?";
shift @INC;
+# [perl #120657]
+sub fake_module {
+ my (undef,$module_file) = @_;
+ !1
+}
+{
+ local @INC = @INC;
+ unshift @INC, (\&fake_module)x2;
+ eval { require "${\'bralbalhablah'}" };
+ like $@, qr/^Can't locate/,
+ 'require PADTMP passing freed var when @INC has multiple subs';
+}
+
+
exit if is_miniperl();
SKIP: {