Make cast() checked by default and add try_cast() for cases where a cast

is not required to be successful.
This commit is contained in:
Michael Hansen
2022-12-01 16:13:31 -08:00
parent 305494c4b2
commit ffeabc3d3f
6 changed files with 36 additions and 38 deletions

View File

@@ -304,7 +304,7 @@ int main(int argc, char* argv[])
fprintf(pyc_output, "%s (Python %d.%d%s)\n", dispname, mod.majorVer(), mod.minorVer(),
(mod.majorVer() < 3 && mod.isUnicode()) ? " -U" : "");
try {
output_object(mod.code().cast<PycObject>(), &mod, 0);
output_object(mod.code().try_cast<PycObject>(), &mod, 0);
} catch (std::exception& ex) {
fprintf(stderr, "Error disassembling %s: %s\n", infile, ex.what());
return 1;