Skip to content

Commit

Permalink
use permissive PDL::Type->new not string-eval
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Nov 10, 2024
1 parent e64795c commit 79012e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Basic/IO-Storable/storable.pd
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ sub pdlunpack {
my ($typestring) = unpack( 'A16', substr( $pack, $offset ) );
$offset += 16;
$type = eval( '$PDL::Types::' . $typestring );
$typestring =~ s#\s+$##;
$type = eval { PDL::Type->new($typestring)->enum };
if( $@ )
{
croak "PDL::IO::Storable couldn't parse type string '$typestring'. Giving up";
Expand Down Expand Up @@ -224,8 +225,6 @@ sub pdlunpack {
$do_swap = 1;
}
# mostly this acts like unpack('Q<'...), but works even if my unpack()
# doesn't support 'Q'. This also makes sure that my PDL_Indx is large enough
# to read this ndarray
Expand Down

0 comments on commit 79012e1

Please sign in to comment.