classification
Title: Regression in timeit with multyline setup
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-07-14 05:10 by serhiy.storchaka, last changed 2015-07-15 19:13 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
timeit_multiline_setup.patch serhiy.storchaka, 2015-07-14 18:20 review
Messages (5)
msg246717 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-07-14 05:10
Issue5633 introduced a regression in 3.5.

$ ./python -m timeit -s "a = 1" -s "b = 2"
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.5/Lib/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/serhiy/py/cpython-3.5/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/serhiy/py/cpython-3.5/Lib/timeit.py", line 338, in <module>
    sys.exit(main())
  File "/home/serhiy/py/cpython-3.5/Lib/timeit.py", line 296, in main
    t = Timer(stmt, setup, timer)
  File "/home/serhiy/py/cpython-3.5/Lib/timeit.py", line 122, in __init__
    compile(setup + '\n' + stmt, dummy_src_name, "exec")
  File "<timeit-src>", line 2
    b = 2
    ^
IndentationError: unexpected indent

Proposed patch fixes it.
msg246735 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-07-14 17:18
There's no patch to review.
msg246736 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-07-14 18:20
Oh, sorry. Here is it.
msg246770 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-07-15 17:41
Patch LGTM
msg246774 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-07-15 19:12
New changeset fce682a493e7 by Serhiy Storchaka in branch '3.5':
Issue #24631: Fixed regression in the timeit modulu with multyline setup.
https://hg.python.org/cpython/rev/fce682a493e7

New changeset 0b04e5689c33 by Serhiy Storchaka in branch 'default':
Issue #24631: Fixed regression in the timeit modulu with multyline setup.
https://hg.python.org/cpython/rev/0b04e5689c33
History
Date User Action Args
2015-07-15 19:13:13serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2015-07-15 19:12:55python-devsetnosy: + python-dev
messages: + msg246774
2015-07-15 17:41:26brett.cannonsetmessages: + msg246770
stage: patch review -> commit review
2015-07-14 18:20:04serhiy.storchakasetfiles: + timeit_multiline_setup.patch
keywords: + patch
messages: + msg246736

stage: needs patch -> patch review
2015-07-14 17:18:38brett.cannonsetnosy: + brett.cannon

messages: + msg246735
stage: patch review -> needs patch
2015-07-14 05:10:51serhiy.storchakacreate