diff --git a/pycdas.cpp b/pycdas.cpp index 3f079ab..724149d 100644 --- a/pycdas.cpp +++ b/pycdas.cpp @@ -18,12 +18,11 @@ static const char* flag_names[] = { "CO_OPTIMIZED", "CO_NEWLOCALS", "CO_VARARGS", "CO_VARKEYWORDS", "CO_NESTED", "CO_GENERATOR", "CO_NOFREE", "CO_COROUTINE", "CO_ITERABLE_COROUTINE", "<0x200>", "<0x400>", "<0x800>", - "CO_GENERATOR_ALLOWED", "CO_FUTURE_DIVISION", - "CO_FUTURE_ABSOLUTE_IMPORT", "CO_FUTURE_WITH_STATEMENT", - "CO_FUTURE_PRINT_FUNCTION", "CO_FUTURE_UNICODE_LITERALS", - "CO_FUTURE_BARRY_AS_BDFL", "CO_FUTURE_GENERATOR_STOP", - "<0x100000>", "<0x200000>", "<0x400000>", "<0x800000>", - "<0x1000000>", "<0x2000000>", "<0x4000000>", "<0x8000000>", + "CO_GENERATOR_ALLOWED", "<0x2000>", "<0x4000>", "<0x8000>", + "<0x10000>", "CO_FUTURE_DIVISION", "CO_FUTURE_ABSOLUTE_IMPORT", "CO_FUTURE_WITH_STATEMENT", + "CO_FUTURE_PRINT_FUNCTION", "CO_FUTURE_UNICODE_LITERALS", "CO_FUTURE_BARRY_AS_BDFL", + "CO_FUTURE_GENERATOR_STOP", + "CO_FUTURE_ANNOTATIONS", "CO_NO_MONITORING_EVENTS", "<0x4000000>", "<0x8000000>", "<0x10000000>", "<0x20000000>", "<0x40000000>", "<0x80000000>" }; @@ -102,7 +101,12 @@ void output_object(PycRef obj, PycModule* mod, int indent, if (mod->verCompare(1, 5) >= 0) iprintf(pyc_output, indent + 1, "Stack Size: %d\n", codeObj->stackSize()); if (mod->verCompare(1, 3) >= 0) { - iprintf(pyc_output, indent + 1, "Flags: 0x%08X", codeObj->flags()); + unsigned int orig_flags = codeObj->flags(); + if (mod->verCompare(3, 8) < 0) { + // Remap flags back to the value stored in the PyCode object + orig_flags = (orig_flags & 0xFFFF) | ((orig_flags & 0xFFF00000) >> 4); + } + iprintf(pyc_output, indent + 1, "Flags: 0x%08X", orig_flags); print_coflags(codeObj->flags(), pyc_output); }