Issue 8403: dis.dis gives different results if Ctrl-C is pressed (original) (raw)

Created on 2010-04-15 01:00 by ivank, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg103161 - (view) Author: ivank (ivank) Date: 2010-04-15 01:00
If you run >>> dis.dis(lambda: 99**1000003) and press Ctrl-C immediately, you'll see the numbers without constant folding: 1 0 LOAD_CONST 1 (99) 3 LOAD_CONST 2 (1000003) 6 BINARY_POWER 7 RETURN_VALUE If you wait long enough instead (don't press Ctrl-C), you'll see a very big number. It seems strange to do two different things. Perhaps the KeyboardInterrupt should be rethrown instead?
msg103167 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-04-15 01:24
Probably due to the fact that the peepholer avoids constant folding when any exception happens.
msg103169 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-04-15 01:29
> Probably due to the fact that the peepholer > avoids constant folding when any exception happens. Yes. And that is a feature, not a bug. It would better though if the keyboard interrupt was not swallowed.
msg103170 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-04-15 01:33
2010/4/14 Raymond Hettinger <report@bugs.python.org>: > > Raymond Hettinger <rhettinger@users.sourceforge.net> added the comment: > >> Probably due to the fact that the peepholer >> avoids constant folding when any exception happens. > > Yes.  And that is a feature, not a bug. > > It would better though if the keyboard interrupt was not swallowed. Agreed on both points.
msg114644 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-08-22 08:40
Fixed in r84256. Don't think this needs to be backported.
History
Date User Action Args
2022-04-11 14:56:59 admin set github: 52650
2010-08-22 08:40:32 rhettinger set status: open -> closedresolution: fixedmessages: + versions: + Python 3.2, - Python 2.6, Python 2.7
2010-04-15 01:33:01 benjamin.peterson set messages: +
2010-04-15 01:29:57 rhettinger set assignee: rhettingermessages: + nosy: + rhettinger
2010-04-15 01:24:47 benjamin.peterson set priority: lownosy: + benjamin.petersonmessages: +
2010-04-15 01:00:01 ivank create