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 methane
Recipients FFY00, Mark.Shannon, methane, miurahr
Date 2020-10-19.15:05:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603119932.42.0.367208267189.issue42057@roundup.psfhosted.org>
In-reply-to
Content
I confirmed the issue. The simple version of the reproducer is:

```
def callee():
    raise Exception

def caller():
    try:
        callee()
    except Exception or Exception:
        pass

caller()
```

I can see assertion failure consisntently, when I use python --with-pydebug.

It seems peephole bug. Without peephole:

```
  7     >>   12 DUP_TOP
             14 LOAD_GLOBAL              1 (Exception)
             16 JUMP_IF_TRUE_OR_POP     20
             18 LOAD_GLOBAL              1 (Exception)
        >>   20 JUMP_IF_NOT_EXC_MATCH    32
             22 POP_TOP
             24 POP_TOP
             26 POP_TOP

  8          28 POP_EXCEPT
             30 JUMP_FORWARD             2 (to 34)
        >>   32 RERAISE
        >>   34 LOAD_CONST               0 (None)
             36 RETURN_VALUE
```

And with peephole:

```
  7     >>   12 DUP_TOP
             14 LOAD_GLOBAL              1 (Exception)
             16 POP_JUMP_IF_TRUE        22
             18 LOAD_GLOBAL              1 (Exception)
             20 JUMP_IF_NOT_EXC_MATCH    32
        >>   22 POP_TOP
             24 POP_TOP
             26 POP_TOP

  8          28 POP_EXCEPT
             30 JUMP_FORWARD             2 (to 34)
        >>   32 RERAISE
        >>   34 LOAD_CONST               0 (None)
             36 RETURN_VALUE
```

JUMP_IF_TRUE_OR_POP is converted into POP_JUMP_IF_TRUE. Exception is popped although JUMP_IF_NOT_EXC_MATCH needs it.
History
Date User Action Args
2020-10-19 15:05:32methanesetrecipients: + methane, Mark.Shannon, FFY00, miurahr
2020-10-19 15:05:32methanesetmessageid: <1603119932.42.0.367208267189.issue42057@roundup.psfhosted.org>
2020-10-19 15:05:32methanelinkissue42057 messages
2020-10-19 15:05:32methanecreate