[Python-Dev] Re: Non-monotonically increasing line numbers in dis.findlinestarts() output

2021-03-18 Thread Serhiy Storchaka
18.03.21 03:39, Victor Stinner пише: > I'm happy to see that Python 3.10 now also implements faster bytecode > which rely on this change ;-) It was used long time ago before 3.10. For example: a[i] = \ f() 2 0 LOAD_NAME0 (f) 2 CALL_FUNCTION

[Python-Dev] Re: Non-monotonically increasing line numbers in dis.findlinestarts() output

2021-03-17 Thread Victor Stinner
Hi Skip, I modified co_lnotab format when I worked on the FAT Python optimization project which modified the AST to emit more efficient bytecode. My optimizer moved instructions, the line number could become non-monotonic (..., line 2, line 3, line 2, line 4, ...), and so lnotab (..., +1, -1, +2,

[Python-Dev] Re: Non-monotonically increasing line numbers in dis.findlinestarts() output

2021-03-17 Thread Skip Montanaro
> co_lnotab has had negative deltas since 3.6. Thanks. I'm probably misreading Objects/lnotab_notes.txt. Skip ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

[Python-Dev] Re: Non-monotonically increasing line numbers in dis.findlinestarts() output

2021-03-17 Thread Ned Batchelder
On 3/17/21 6:41 PM, MRAB wrote: On 2021-03-17 22:10, Skip Montanaro wrote: I stumbled on this while trying to generate a line number table in my side project register VM. As I understand it, the line number delta in the output table is supposed to always be >= 0. In my code I'm using

[Python-Dev] Re: Non-monotonically increasing line numbers in dis.findlinestarts() output

2021-03-17 Thread MRAB
On 2021-03-17 22:10, Skip Montanaro wrote: Consider this little session from the tip of the spear: >>> sys.version '3.10.0a6+ (heads/master:0ab152c6b5, Mar 15 2021, 17:24:38) [GCC 10.2.0]' >>> def while2(a): ...     while a >= 0: ...         a -= 1 ...     return a ... >>> dis.dis(while2)