Skip to content

Commit 7e2a0d4

Browse files
author
Father Chrysostomos
committed
Storable: blessed long vstrings
I made a mistake in the long vstring code. The stored blessing was being ignored.
1 parent 4ad9e49 commit 7e2a0d4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

dist/Storable/Storable.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4943,7 +4943,7 @@ static SV *retrieve_lvstring(pTHX_ stcxt_t *cxt, const char *cname)
49434943
New(10003, s, len+1, char);
49444944
SAFEPVREAD(s, len, s);
49454945

4946-
sv = retrieve(aTHX_ cxt, 0);
4946+
sv = retrieve(aTHX_ cxt, cname);
49474947

49484948
sv_magic(sv,NULL,PERL_MAGIC_vstring,s,len);
49494949
/* 5.10.0 and earlier seem to need this */

dist/Storable/t/blessed.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use Storable qw(freeze thaw store retrieve);
3030
%::weird_refs = (
3131
REF => \(my $aref = []),
3232
VSTRING => \(my $vstring = v1.2.3),
33+
'long VSTRING' => \(my $vstring = eval "v" . 0 x 300),
3334
LVALUE => \(my $substr = substr((my $str = "foo"), 0, 3)),
3435
);
3536
}
@@ -285,7 +286,7 @@ is(ref $t, 'STRESS_THE_STACK');
285286
my $thawn = thaw($frozen);
286287
# is_deeply ignores blessings
287288
is ref $thawn, ref $obj, "get the right blessing back for $weird";
288-
if ($weird eq 'VSTRING') {
289+
if ($weird =~ 'VSTRING') {
289290
# It is not just Storable that did not support vstrings. :-)
290291
# See https://rt.cpan.org/Ticket/Display.html?id=78678
291292
my $newver = "version"->can("new")

0 commit comments

Comments
 (0)