Add bytecode support for Python 3.9 rc2

This commit is contained in:
Michael Hansen
2020-09-29 09:28:15 -07:00
parent 045b624f55
commit 8460d119fd
8 changed files with 326 additions and 170 deletions

View File

@@ -32,6 +32,7 @@ DECLARE_PYTHON(3, 5)
DECLARE_PYTHON(3, 6)
DECLARE_PYTHON(3, 7)
DECLARE_PYTHON(3, 8)
DECLARE_PYTHON(3, 9)
const char* Pyc::OpcodeName(int opcode)
{
@@ -97,6 +98,7 @@ int Pyc::ByteToOpcode(int maj, int min, int opcode)
case 6: return python_36_map(opcode);
case 7: return python_37_map(opcode);
case 8: return python_38_map(opcode);
case 9: return python_39_map(opcode);
}
break;
}
@@ -346,6 +348,14 @@ void bc_disasm(PycRef<PycCode> code, PycModule* mod, int indent)
fprintf(pyc_output, "%d (%s)", operand, cmp_strings[operand]);
else
fprintf(pyc_output, "%d (UNKNOWN)", operand);
} else if (opcode == Pyc::IS_OP_A) {
fprintf(pyc_output, "%d (%s)", operand, (operand == 0) ? "is"
: (operand == 1) ? "is not"
: "UNKNOWN");
} else if (opcode == Pyc::CONTAINS_OP_A) {
fprintf(pyc_output, "%d (%s)", operand, (operand == 0) ? "in"
: (operand == 1) ? "not in"
: "UNKNOWN");
} else {
fprintf(pyc_output, "%d", operand);
}