From db22bf8db6e2e67b7b3042cb42f6ef4330be9771 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 23 Feb 2021 13:07:51 +0100 Subject: [PATCH] allow PVMG in deserialization they are supposed to end up being regular scalars after all, usually Signed-off-by: Wolfgang Bumiller --- perlmod/src/scalar.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/perlmod/src/scalar.rs b/perlmod/src/scalar.rs index 675fd6f..7c92191 100644 --- a/perlmod/src/scalar.rs +++ b/perlmod/src/scalar.rs @@ -193,18 +193,13 @@ impl ScalarRef { Type::Reference } else { let flags = ffi::RSPL_type_flags(self.sv()); - if flags > 0xff { - // we may possibly get here via a `#[raw]` scalar reference (though not - // really?) - Type::Other(0) - //panic!("bad C type returned"); - } else if flags != 0 { - // non-scalars will not have any flags: - Type::Scalar(Flags::from_bits(flags as u8).unwrap()) - } else if ffi::RSPL_is_array(self.sv()) { + if ffi::RSPL_is_array(self.sv()) { Type::Array } else if ffi::RSPL_is_hash(self.sv()) { Type::Hash + } else if flags != 0 { + // non-scalars will not have any flags: + Type::Scalar(Flags::from_bits_truncate(flags as u8)) } else { // but `undef` also has no flags, so: let ty = ffi::RSPL_svtype(self.sv());