[issue32421] Keeping an exception in cache can segfault the interpreter

2017-12-23 Thread Yonatan Zunger
New submission from Yonatan Zunger <zun...@gmail.com>: Using the following decorator to memoize a function causes the interpreter to segfault on exit if any exceptions were stored in the cache. Changing the bad line to instead store copy.copy(e) makes the problem go away. Almost cer

[issue32421] Keeping an exception in cache can segfault the interpreter

2017-12-24 Thread Yonatan Zunger
Yonatan Zunger <zun...@gmail.com> added the comment: It's just a clean version of reraise. Part of the six (Py2/Py3 compatibility) library, but pretty useful on its own anyway. On Sun, Dec 24, 2017 at 8:37 PM, Nitish <rep...@bugs.python.org> wrote: > > Nitish <nitis...@

[issue32421] Keeping an exception in cache can segfault the interpreter

2017-12-26 Thread Yonatan Zunger
Yonatan Zunger <zun...@gmail.com> added the comment: 3.6.2. But Nick Coghlan pointed out elsewhere that the underlying issue is more likely to be one of the other objects being pinned in-memory because of the traceback, so the exception may actually be just an incidental thing. I'm going t

[issue34115] code.InteractiveConsole.interact() closes stdin

2018-07-20 Thread Yonatan Zunger
Yonatan Zunger added the comment: Testing your code sample on OS X (10.13.6) with Python 3.6.2: - quit() in the console yields Exc 0: closed is True Python 3.6.2 (default, Apr 17 2018, 12:29:33) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin Type "help",

[issue34115] code.InteractiveConsole.interact() closes stdin

2018-07-20 Thread Yonatan Zunger
Yonatan Zunger added the comment: Or perhaps in an alternate phrasing: The sys.stdin.close behavior makes sense if quit is being used inside IDLE, but is very surprising from the perspective of the `code` module. (Really, even the SystemExit is surprising there, and should be documented

[issue34115] code.InteractiveConsole.interact() closes stdin

2018-07-14 Thread Yonatan Zunger
New submission from Yonatan Zunger : code.InteractiveConsole.interact() closes stdin on exit, which can be very surprising to successive code, not least future calls to interact(). A simple repro with a workaround is: import code import io import os import sys def run(): print

[issue34115] code.InteractiveConsole.interact() closes stdin

2018-07-24 Thread Yonatan Zunger
Yonatan Zunger added the comment: Eryk: Thanks for finding that! So that I'm sure I understand, if 34187 is resolved, does that mean the stdin.close() is no longer required at all in _Quitter? On Sun, Jul 22, 2018 at 2:12 AM Eryk Sun wrote: > > Eryk Sun added the comment: > >

[issue34115] code.InteractiveConsole.interact() closes stdin

2018-07-21 Thread Yonatan Zunger
Yonatan Zunger added the comment: Definitely agree about the difference. I'd say that either SystemExit or EOFError would be a reasonable thing for the interactive session to do, but the combination of closing stdin and SystemExit is really weird. Honestly, I would have just expected interact

[issue32421] Keeping an exception in cache can segfault the interpreter

2018-03-17 Thread Yonatan Zunger
Yonatan Zunger <zun...@gmail.com> added the comment: Apologies -- I've been completely swamped and haven't had time to build a repro case. I don't think I have enough state on the way I found this to reconstruct it easily right now, so I'll close it and re-open if I find it