Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Added support python 3.9 #25

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/googleclouddebugger/bytecode_manipulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,17 @@ static PythonOpcodeType GetOpcodeType(uint8 opcode) {
#endif
case SETUP_FINALLY:
case SETUP_WITH:
#if PY_VERSION_HEX >= 0x03080000
#if PY_VERSION_HEX >= 0x03080000 && PY_VERSION_HEX < 0x03090000
// Added in Python 3.8 and removed in 3.9
case CALL_FINALLY:
#endif
#if PY_VERSION_HEX >= 0x03090000
// Added in 3.9.
case RERAISE:
case WITH_EXCEPT_START:
#endif


return BRANCH_DELTA_OPCODE;

case JUMP_IF_FALSE_OR_POP:
Expand Down
28 changes: 25 additions & 3 deletions src/googleclouddebugger/immutability_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,26 @@ static OpcodeMutableStatus IsOpcodeMutable(const uint8 opcode) {
case UNPACK_EX:
case CALL_FUNCTION_EX:
case LOAD_CLASSDEREF:
#if PY_VERSION_HEX < 0x03090000
// Removed in Python 3.9.
case BUILD_LIST_UNPACK:
case BUILD_MAP_UNPACK:
case BUILD_MAP_UNPACK_WITH_CALL:
case BUILD_TUPLE_UNPACK:
case BUILD_SET_UNPACK:
case BUILD_TUPLE_UNPACK_WITH_CALL:
#endif
#if PY_VERSION_HEX > 0x03090000
// Added in Python 3.9.
case DICT_MERGE:
case DICT_UPDATE:
case LIST_TO_TUPLE:
case LIST_EXTEND:
case SET_UPDATE:
#endif
case FORMAT_VALUE:
case BUILD_CONST_KEY_MAP:
case BUILD_STRING:
case BUILD_TUPLE_UNPACK_WITH_CALL:
#if PY_VERSION_HEX >= 0x03070000
// Added in Python 3.7.
case LOAD_METHOD:
Expand Down Expand Up @@ -433,7 +444,6 @@ static OpcodeMutableStatus IsOpcodeMutable(const uint8 opcode) {
case STORE_DEREF:
// TODO: allow exception handling
case RAISE_VARARGS:
case END_FINALLY:
case SETUP_WITH:
// TODO: allow closures
case LOAD_CLOSURE:
Expand All @@ -447,8 +457,12 @@ static OpcodeMutableStatus IsOpcodeMutable(const uint8 opcode) {
case BEFORE_ASYNC_WITH:
case LOAD_BUILD_CLASS:
case GET_AWAITABLE:
#if PY_VERSION_HEX < 0x03090000
// Removed in 3.9.
case WITH_CLEANUP_START:
case WITH_CLEANUP_FINISH:
case END_FINALLY:
#endif
case SETUP_ANNOTATIONS:
case POP_EXCEPT:
#if PY_VERSION_HEX < 0x03070000
Expand All @@ -459,11 +473,19 @@ static OpcodeMutableStatus IsOpcodeMutable(const uint8 opcode) {
case SETUP_ASYNC_WITH:
#if PY_VERSION_HEX >= 0x03080000
// Added in Python 3.8.
case BEGIN_FINALLY:
case END_ASYNC_FOR:
#endif
#if PY_VERSION_HEX >= 0x03080000 && PY_VERSION_HEX < 0x03090000
// Added in Python 3.8 and removed in 3.9
case BEGIN_FINALLY:
case CALL_FINALLY:
case POP_FINALLY:
#endif
#if PY_VERSION_HEX >= 0x03090000
// Added in 3.9.
case RERAISE:
case WITH_EXCEPT_START:
#endif
#else
case STORE_SLICE+0:
case STORE_SLICE+1:
Expand Down