diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-25 07:07:37 -0700 |
---|---|---|
committer | Ricardo Signes <rjbs@cpan.org> | 2013-12-21 15:48:42 -0500 |
commit | 779a0fdd68e4b21ddb5147b84c953928b51b1fee (patch) | |
tree | 4acf786a3f0d87d6dd3be8f481dbe1cb83a0fda9 | |
parent | 4d67a00be54e2633f43cc526548f7eba24a26c8e (diff) | |
download | perl-779a0fdd68e4b21ddb5147b84c953928b51b1fee.tar.gz |
Unbreak Concise glob output
$ ./perl -MO=Concise -Ilib -le '; print <\n>'
8 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 23 -e:1) v:{ ->3
7 <@> print vK ->8
3 <0> pushmark s ->4
6 <@> glob[t2] lK/1 ->7
- <0> ex-pushmark s ->4
4 <$> const[PV "\n"] s ->5
Can't locate object method "NAME" via package "B::SPECIAL" at lib/B/Concise.pm line 707.
CHECK failed--call queue aborted.
e88567f2acf38fe5ed90a88569b808e82cd3eca1 is the first bad commit
commit e88567f2acf38fe5ed90a88569b808e82cd3eca1
Author: Father Chrysostomos <sprout@cpan.org>
Date: Sun Nov 4 20:18:51 2012 -0800
Stop the glob operator from leaking GVs
It was adding GVs to the symbol table (via newGVgen), so they
would never be freed, even after the op was freed, unless done so
explicitly.
There is no reason for these GVs to be exposed.
That means $gv->STASH returns a B::SPECIAL. B::Concise was not pre-
pared to handle that.
(cherry picked from commit 7b696247e72c0b92f1fcee2a830851021827aa4b)
-rw-r--r-- | ext/B/B/Concise.pm | 9 | ||||
-rw-r--r-- | ext/B/t/concise.t | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 67876a1c8c..686bfafa23 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -711,7 +711,14 @@ sub concise_sv { $hr->{svaddr} = sprintf("%#x", $$sv); if ($hr->{svclass} eq "GV" && $sv->isGV_with_GP()) { my $gv = $sv; - my $stash = $gv->STASH->NAME; if ($stash eq "main") { + my $stash = $gv->STASH; + if (class($stash) eq "SPECIAL") { + $stash = "<none>"; + } + else { + $stash = $stash->NAME; + } + if ($stash eq "main") { $stash = ""; } else { $stash = $stash . "::"; diff --git a/ext/B/t/concise.t b/ext/B/t/concise.t index ec911a0d8c..ac38bfda1f 100644 --- a/ext/B/t/concise.t +++ b/ext/B/t/concise.t @@ -10,7 +10,7 @@ BEGIN { require 'test.pl'; # we use runperl from 'test.pl', so can't use Test::More } -plan tests => 160; +plan tests => 161; require_ok("B::Concise"); @@ -455,4 +455,11 @@ $out = ); unlike $out, 'main::foo', '-nobanner'; +# glob +$out = + runperl( + switches => ["-MO=Concise"], prog=>'<.>', stderr => 1 + ); +like $out, '\*<none>::', '<.>'; + __END__ |