From 14177b772100aa9b405e8cb21ab13395a67368eb Mon Sep 17 00:00:00 2001 From: Ed J Date: Thu, 24 Oct 2024 16:37:15 +0100 Subject: [PATCH] error if undefined values to PDL constructors --- Basic/Core/Core.xs | 3 +++ Changes | 1 + 2 files changed, 4 insertions(+) diff --git a/Basic/Core/Core.xs b/Basic/Core/Core.xs index 99e1200c3..9ac4ec098 100644 --- a/Basic/Core/Core.xs +++ b/Basic/Core/Core.xs @@ -204,6 +204,9 @@ new_from_specification(invoc, ...) XSRETURN(1); } } + IV i; for (i = 0; i < items; i++) + if (!SvOK(ST(i))) + barf("Arg %"IVdf" is undefined", i); IV argstart = 1, type = PDL_D; if (items > 1 && sv_derived_from(ST(1), "PDL::Type")) { argstart++; diff --git a/Changes b/Changes index dac4198ed..d2ea0537a 100644 --- a/Changes +++ b/Changes @@ -15,6 +15,7 @@ - get_dataref now works even with DONTTOUCHDATA which is really about allocation - if $pdl->{PDL} is code ref, $pdl now passed as arg - add PDL::Hash to simplify hash-based PDL subclasses +- now an error to pass any undefined values to PDL constructors 2.093 2024-09-29 - PDL.set_datatype now doesn't physicalise input, PDL.convert_type does