Conversation
bad6239 to
271b0a4
Compare
|
hi @alexmojaki, I'm currently working on the 3.13 branch but found some issues with the SentinelNode finder which cause failing tests. The test failures are random in the ci because we test a random subset of the cpython source code. I fixed some of theme but I have now one problem which I don't know to solve. The last wip commit of this branch contains a small_sample which reproduces this bug. (dict(((k.lower(), v) for (k, v) in self.itermerged())) == (k.lower for (k, v) in something))you can analyse it with: I hope you can help fixing it or understand why this bytecode can not be found, in which case we would need some code in |
|
This bug can be reproduced with python 3.8.3 |
|
Can you give a traceback for the error? |
The execption is raised inside the test, because it can not find bytecode for the node. It looks for me like the bytecode node mapping fails and this node is missing a bytecode now. But I have no idea what the problem with this code sample could be. |
|
I meant a traceback for the exception |
|
here is the backtrace where the NotOneValueFound exception is raised: You can see the code objects in the screenshot above where I analysed them. |
|
After making AST modifications with the sentinel and compiling that, it needs to find which code object contains the changes. So it looks for a code object that looks similar to the code object of the original frame. The instructions will necessarily contain some differences so it can't use those to match. You can see the heuristics used in Now that I think about it, it could probably just look for a code object which has the sentinel string in Otherwise, this is a known limitation that goes back all the way to the beginning. See Line 201 in 6a54f98 <genexpr> codes on the same line, containing the same variable names (self and something aren't in those frames). Change k to k2 in one of them, or put a newline between them, and the problem should go away. This has probably never happened before in test_sys_modules, and if it's not easy to apply the suggested fix above then it's fine to just skip the file/module where it happens based on its name.
|
|
Thank you for the explanation. I skipped the module tests for now in the 3.13 branch. I will look at it later again. |
|
Ah, but executing/executing/executing.py Lines 669 to 684 in 6a54f98 But it only needs to do that if there are any |
|
I added the fix that you proposed, but I get now an exception at a different place: |
I will try this |
|
OK, I tried this for a while, it doesn't really work. I could maybe make it work in your case where the instructions are clearly different, but it doesn't seem worth it. Let's just skip this specific edge case. |

different fixes for the SentinelNodeFinder
currently work in progress.
The question if this are required when we stop supporting python < 3.8
#64 is a new node finder which could be used for the same versions.