bpo-40670: More reliable validation of statements in timeit.Timer. (GH-22358)

It now accepts "empty" statements (only whitespaces and comments)
and rejects misindentent statements.
This commit is contained in:
Serhiy Storchaka 2020-09-22 16:16:46 +03:00 committed by GitHub
parent c5cb077ab3
commit 557b9a52ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -72,6 +72,7 @@ def inner(_it, _timer{init}):
_t0 = _timer()
for _i in _it:
{stmt}
pass
_t1 = _timer()
return _t1 - _t0
"""