Skip to content

Commit

Permalink
error if give null to an [io] Par - #511
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jan 1, 2025
1 parent 95be933 commit 01a8b3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- eigens_sym now sorts output like EISPACK
- Math::isfinite no longer works inplace due to mismatch between Pars (#511)
- now an error to specify Inplace between differently-typed Pars (#511)
- now an error to give a null to an [io] Par (#511)

2.095 2024-11-03
- add PDL_GENTYPE_IS_{REAL,FLOATREAL,COMPLEX,SIGNED,UNSIGNED}_##ppsym (#502)
Expand Down
5 changes: 5 additions & 0 deletions lib/PDL/Core/pdlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,11 @@ static inline pdl_error pdl_trans_flow_null_checks(pdl_trans *trans, char *disab
pdl *child = trans->pdls[i];
if (_trans_forward_only(child))
return pdl_make_error(PDL_EUSERERROR, "%s: cannot output to parameter '%s' with inward but no backward flow", vtable->name, vtable->par_names[i]);
if (child->state & PDL_NOMYDIMS && !(vtable->par_flags[i] & PDL_PARAM_ISCREAT))
return pdl_make_error(PDL_EUSERERROR,
"Error in %s: io parameter '%s' is null",
vtable->name, vtable->par_names[i]
);
}
*disable_back = input_forward_only;
return PDL_err;
Expand Down
3 changes: 3 additions & 0 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ is_pdl +(5*sequence(5))->maximum_n_ind(3), indx(4,3,2), 'named dim';
# pptest for dim with fixed value
is_pdl crossp([1..3],[4..6]), longlong(-3,6,-3), {test_name=>'named dim=3', require_equal_types=>0};

eval {simq(null, zeroes(3), 0)};
like $@, qr/io.*null/;

subtest 'dim compatibility' => sub {
for (
# non-phys params
Expand Down

0 comments on commit 01a8b3a

Please sign in to comment.