File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -811,4 +811,47 @@ sub {
811
811
};
812
812
test_ref_to_unavailable();
813
813
814
+ {
815
+ # 22547
816
+ fresh_perl_is(<<'EOC' , " OK" , {}, " RT #22547" );
817
+ use builtin qw(weaken);
818
+
819
+ my $wref;
820
+ {
821
+ my $x;
822
+ my $subject = sub {
823
+ $x = $_[0];
824
+
825
+ my $y;
826
+ return sub { $y };
827
+ };
828
+ my $subscriber = {};
829
+ weaken($wref = $subscriber);
830
+ $subscriber->{foo} = $subject->($subscriber);
831
+ }
832
+ !defined $wref and print "OK";
833
+ EOC
834
+
835
+ local $TODO = " still leaks with eval ''" ;
836
+ fresh_perl_is(<<'EOC' , " OK" , {}, " RT #22547 with eval" );
837
+ use builtin qw(weaken);
838
+
839
+ my $wref;
840
+ {
841
+ my $x;
842
+ my $subject = sub {
843
+ $x = $_[0];
844
+
845
+ my $y;
846
+ return sub { eval "1"; $y };
847
+ };
848
+ my $subscriber = {};
849
+ weaken($wref = $subscriber);
850
+ $subscriber->{foo} = $subject->($subscriber);
851
+ }
852
+ !defined $wref and print "OK";
853
+ EOC
854
+ }
855
+
856
+
814
857
done_testing();
You can’t perform that action at this time.
0 commit comments