Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialisation - add FREEZE and THAW support #510

Open
shawnlaffan opened this issue Dec 15, 2024 · 0 comments
Open

serialisation - add FREEZE and THAW support #510

shawnlaffan opened this issue Dec 15, 2024 · 0 comments

Comments

@shawnlaffan
Copy link
Contributor

shawnlaffan commented Dec 15, 2024

Serialisation using Sereal, and presumably other such systems, results in fatal errors. Reproducer below, along with its output.

Fixing this should (one hopes) just be a case of adding FREEZE and THAW methods, as documented at https://metacpan.org/pod/Sereal::Encoder#FREEZE%2FTHAW-CALLBACK-MECHANISM

Similar code has already been added for Storable via PDL::IO::Storable so it should be a case of reusing that.

I'll run some testing and if it works then I'll raise a PR.

#  reproducer
use strict;
use warnings;
use 5.014;
use PDL;
use Sereal qw/decode_sereal encode_sereal/;
my $x = decode_sereal encode_sereal (xvals(25,25));

say 'Result:';
say '=====';
say $x;
say '=====';
say 'Script completed';
Result:
=====
Stringizing problem: Fatal error: argument is probably not an ndarray, or magic no overwritten. You're in trouble, guv: 2453f26e5a8 245412ebf40 1111638597
 at C:/perls/5.40.0.1_PDL/perl/vendor/lib/PDL/Core.pm line 3294.
        PDL::string(PDL=SCALAR(0x2453f26e5a8), undef, "") called at serialise.pl line 9
        (in cleanup) Fatal error: argument is probably not an ndarray, or magic no overwritten. You're in trouble, guv: 2453f26e5a8 245412ebf40 1111638597
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant