New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistencies in tracing list comprehensions #54075
Comments
Attached test script, tracetest.py, prints disassembly followed by a trace of the following function: 1 def f(): With default configuration, the output is 2 0 LOAD_CONST 1 (<code object <listcomp> at 0x100484e00, file "tracetest.py", line 2>) 4 6 LOAD_GLOBAL 0 (range) 3 9 STORE_FAST 1 (i) but with configuration using --without-computed-gotos option, the disassembly is the same, but the trace is different: ['2 0 LOAD_CONST', '4 6 LOAD_GLOBAL', '2 0 BUILD_LIST', '2 6 FOR_ITER', '2 6 FOR_ITER'] This behavior changed between 3.1 and 3.2 (likely in r74132), but it is inconsistent in both versions. Since r74132 changes were not backported to 3.1, I am classifying this as 3.2 only even though the problem is present in 3.1 as well. |
As I said in bpo-9315, I think this kind of thing (bytecode traces) is an implementation detail; the changes in results shouldn't be regarded as breaking compatibility. |
On Wed, Sep 15, 2010 at 5:33 PM, Antoine Pitrou <report@bugs.python.org> wrote:
In r74132, an attempt was made to rationalize and document line
This is exactly what my example demonstrates. |
I have found the root cause of these differences. The trace function is not called when the opcode is successfully predicted. When computed gotos are enabled, opcode prediction is disabled as explained in the following comment in ceval.c:
Note that this issue is similar to bpo-884022 which was resolved by disabling opcode prediction in dynamic profile builds. Given that opcode prediction if off by default, I don't see much of the reason to try to improve tracing of predicted opcodes. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: