This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nedbat
Recipients nedbat, serhiy.storchaka
Date 2018-10-04.00:00:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538611241.01.0.545547206417.issue34888@psf.upfronthosting.co.za>
In-reply-to
Content
Looks like the optimizer is getting more aggressive.  Line 2 (the constant while) no longer even appears in the bytecode:

$ cat -n whiletrue.py
     1	a = 1
     2	while 1:
     3	    print(a)
     4	b = 4

$ python3.7 -m dis < whiletrue.py
  1           0 LOAD_CONST               0 (1)
              2 STORE_NAME               0 (a)

  2           4 SETUP_LOOP              12 (to 18)

  3     >>    6 LOAD_NAME                1 (print)
              8 LOAD_NAME                0 (a)
             10 CALL_FUNCTION            1
             12 POP_TOP
             14 JUMP_ABSOLUTE            6
             16 POP_BLOCK

  4     >>   18 LOAD_CONST               1 (4)
             20 STORE_NAME               2 (b)
             22 LOAD_CONST               2 (None)
             24 RETURN_VALUE

$ python3.8 -m dis < whiletrue.py
  1           0 LOAD_CONST               0 (1)
              2 STORE_NAME               0 (a)

  3     >>    4 LOAD_NAME                1 (print)
              6 LOAD_NAME                0 (a)
              8 CALL_FUNCTION            1
             10 POP_TOP
             12 JUMP_ABSOLUTE            4

  4          14 LOAD_CONST               1 (4)
             16 STORE_NAME               2 (b)
             18 LOAD_CONST               2 (None)
             20 RETURN_VALUE


I understand why we want to make these optimizations.  It's good for those times when we run our programs.  But there are other times: when we are analyzing programs.

I'm begging you: please please please help me get https://bugs.python.org/issue2506 implemented (a way to disable optimizations).  It is becoming more and more difficult to write tools that analyze Python programs.

People are testing their libraries on Python 3.8-dev, and reporting problems using coverage.py.  I would like to support their efforts to test on the daily Python builds.  But it's difficult to keep coverage.py working under these conditions.

Anything you can do would be really appreciated.
History
Date User Action Args
2018-10-04 00:00:41nedbatsetrecipients: + nedbat, serhiy.storchaka
2018-10-04 00:00:41nedbatsetmessageid: <1538611241.01.0.545547206417.issue34888@psf.upfronthosting.co.za>
2018-10-04 00:00:40nedbatlinkissue34888 messages
2018-10-04 00:00:40nedbatcreate