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 serhiy.storchaka
Recipients DahlitzFlorian, anthonypjshaw, edison.abahurire, rahul-kumi, remi.lapeyre, serhiy.storchaka
Date 2020-05-21.08:29:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590049749.63.0.708245689482.issue40670@roundup.psfhosted.org>
In-reply-to
Content
Accepting an empty string in CLI is just an artifact of the implementation.  There was no intention to support it. It will fail if pass a space:

    ./python -m timeit ' '

or two empty arguments:
IndentationError:
    ./python -m timeit '' ''

I do not see this is an issue. Garbage in -- garbage out. IndentationError is a subclass of SyntaxError, so if you handle it programmatically, it does not matter.

Of course we try to catch some user errors and provide informative traceback. timeit now correctly handles most of code which interferes with the control flow in functions and loops: 'return', 'yield', 'break', 'await'.

But it is still possible to bypass the validation. For example:

    ./python -m timeit -s 'while False:' -s '    pass' '    break'

I think there is an infinite number of ways to fool timeit. And an empty string is just one of them, not special enough to add a special handling in the code.
History
Date User Action Args
2020-05-21 08:29:09serhiy.storchakasetrecipients: + serhiy.storchaka, anthonypjshaw, DahlitzFlorian, remi.lapeyre, edison.abahurire, rahul-kumi
2020-05-21 08:29:09serhiy.storchakasetmessageid: <1590049749.63.0.708245689482.issue40670@roundup.psfhosted.org>
2020-05-21 08:29:09serhiy.storchakalinkissue40670 messages
2020-05-21 08:29:09serhiy.storchakacreate