Skip to content

Commit 8a14a72

Browse files
committed
tmp: printf debugging
1 parent a15a861 commit 8a14a72

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/binding/python/Attributable.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,22 @@ struct char_to_explicit_char<false>
338338
template <typename TargetType>
339339
std::optional<TargetType> tryCast(py::object const &obj)
340340
{
341+
std::cout << "tryCast<" << determineDatatype<TargetType>() << ">()"
342+
<< std::endl;
341343
try
342344
{
343-
return obj.cast<TargetType>();
345+
auto res = obj.cast<TargetType>();
346+
std::cout << "\tSUCCESS" << std::endl;
347+
return res;
344348
}
345349
catch (py::cast_error const &)
346350
{
351+
std::cout << "\tFAILURE 1" << std::endl;
347352
return std::nullopt;
348353
}
349354
catch (py::value_error const &err)
350355
{
356+
std::cout << "\tFAILURE 2" << std::endl;
351357
return std::nullopt;
352358
}
353359
}
@@ -427,6 +433,11 @@ bool setAttributeFromObject(
427433
pybind11::dtype datatype)
428434
{
429435
Datatype requestedDatatype = dtype_from_numpy(datatype);
436+
std::cout << "Setting attribute '" << key << "' with type "
437+
<< obj.get_type() << "' and requested type " << datatype
438+
<< ", i.e. openPMD type " << requestedDatatype << "\n\t'char' is "
439+
<< (std::is_signed_v<char> ? "signed" : "unsigned")
440+
<< " on the platform" << std::endl;
430441
return switchNonVectorType<SetAttributeFromObject>(
431442
requestedDatatype, attr, key, obj);
432443
}

0 commit comments

Comments
 (0)