-
Notifications
You must be signed in to change notification settings - Fork 25
[Compat][3.11] enable test_11_jumps.py #361
Conversation
zrr1999
commented
Aug 30, 2023
•
edited
Loading
edited
- 给 VariableBase 添加 is_none 方法。
- 优化 PyCodeGen 的 gen_rot_n 方法,针对不同 Python版本,采用不同的字节码。
- 重构 POP_JUMP 相关字节码的实现,提高代码的复用性,并且补齐了 Python3.11 中相关的新字节码。
- 增加更多单测,提高代码稳定性。
Thanks for your contribution! |
@@ -13,7 +13,6 @@ py311_skiped_tests=( | |||
# ./test_04_list.py There are some case need to be fixed | |||
# ./test_05_dict.py There are some case need to be fixed | |||
./test_10_build_unpack.py | |||
./test_11_jumps.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
部分完成的像上面加一个注释吧
tests/test_11_jumps.py
Outdated
self.assert_results(pop_jump_if_not_none, True, a) | ||
|
||
@unittest.skipIf( | ||
sys.version_info >= (3, 11), "Python 3.11+ is not supported yet." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里说明是不支持 breakgraph 吧,其他单测里应该有 "Python 3.11+ not support breakgraph"
tests/test_11_jumps.py
Outdated
self.assert_results(pop_jump_if_none, True, a) | ||
self.assert_results(pop_jump_if_not_none, True, a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的话,测试「None」和「非 None」两种情况吧,共四个
@@ -56,7 +81,13 @@ def test_simple(self): | |||
self.assert_results(jump_if_true_or_pop, False, a) | |||
self.assert_results(pop_jump_if_true, True, False, a) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里和上面是不是有一部分重复了?按理说两个单测 case 应该测不同的分支
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMeow 🐾
@@ -459,7 +459,7 @@ def gen_resume_fn_at(self, index: int, stack_size: int = 0): | |||
gen_instr('LOAD_FAST', argval=stack_arg_str.format(i)) | |||
for i in range(stack_size) | |||
] | |||
+ [gen_instr('JUMP_ABSOLUTE', jump_to=self._instructions[index])] | |||
+ [gen_instr('JUMP_FORWARD', jump_to=self._instructions[index])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里用 JUMP_FORWARD
应该需要确保一点,它是向前跳的
这里应该没问题,因为是函数初始跳转到中间 breakgraph 处