summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/Safe/Safe.pm2
-rw-r--r--dist/Safe/t/safesort.t8
2 files changed, 3 insertions, 7 deletions
diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm
index 6fc8523d03..20efe17eb3 100644
--- a/dist/Safe/Safe.pm
+++ b/dist/Safe/Safe.pm
@@ -358,6 +358,7 @@ sub reval {
? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub)
: scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
_clean_stash($root.'::') if $sg != sub_generation();
+ $obj->wrap_code_refs_within(@subret);
return (wantarray) ? @subret : $subret[0];
}
@@ -436,6 +437,7 @@ sub rdo {
? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub)
: scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
_clean_stash($root.'::') if $sg != sub_generation();
+ $obj->wrap_code_refs_within(@subret);
return (wantarray) ? @subret : $subret[0];
}
diff --git a/dist/Safe/t/safesort.t b/dist/Safe/t/safesort.t
index 797e155f06..2f1c204439 100644
--- a/dist/Safe/t/safesort.t
+++ b/dist/Safe/t/safesort.t
@@ -33,13 +33,7 @@ EOS
is $@, '', 'reval should not fail';
is ref $func, 'CODE', 'reval should return a CODE ref';
-# $func1 will work in non-threaded perl
-# but RT#60374 "Safe.pm sort {} bug with -Dusethreads"
-# means the sorting won't work unless we wrap the code ref
-# such that it's executed with Safe 'in effect' at runtime
-my $func2 = $safe->wrap_code_ref($func1);
-
-my ($l_sorted, $p_sorted) = $func2->(3,1,2);
+my ($l_sorted, $p_sorted) = $func1->(3,1,2);
is $l_sorted, "1,2,3";
is $p_sorted, "1,2,3";