Author p-ganssle
Recipients aldwinaldwin, lukasz.langa, miss-islington, ned.deily, nedbat, p-ganssle, pablogsal, serhiy.storchaka, terry.reedy, xtreak
Date 2019-07-05.21:53:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> CPython has acted the current way for about 15 years (since 2.4 was released), and this is the first time anyone has raised an objection. 

This is the expected result of fixing a bug that has been open since 2008 (11 years), which itself was noticed independently, also in 2008 (#1875 and #1920, respectively). I also independently discovered the same issue last year when writing some tests for IPython, and I suspect others have hit it as well and shrugged it off because it's not that hard to work around and there was an open issue for it.

I will also note that this "not raising a SyntaxError" behavior is a CPython-specific implementation detail (and is quite fragile to boot), note:

    $ cat
    if 0:

    $ python   # Works on 2.7 and <3.8
    $ pypy     # Same behavior with pypy3.6
      File "", line 2
    SyntaxError: return outside function
I am not sure if pypy emits the same bytecode, but I think that

> Please don't break a package as fundamental as coverage.

I think it's a bit melodramatic to consider this "breaking" coverage, particularly since I would find it very weird if any code under an "if 0" were simply *ignored* by coverage, and I would probably report it as a bug. It changes the behavior, sure, but this was code that is legitimately not covered. I don't think it's a big problem to add `# pragma: nocover` to code blocks you don't want covered.
Date User Action Args
2019-07-05 21:53:46p-gansslesetrecipients: + p-ganssle, terry.reedy, nedbat, ned.deily, lukasz.langa, serhiy.storchaka, pablogsal, miss-islington, xtreak, aldwinaldwin
2019-07-05 21:53:46p-gansslesetmessageid: <>
2019-07-05 21:53:46p-gansslelinkissue37500 messages
2019-07-05 21:53:46p-gansslecreate