# Bug report ### Bug description: In the new REPL, failing allocations seem to cause the prompt to get stuck: ```python >>> import _testcapi >>> _testcapi.set_nomemory(0) # Now wait forever ``` I don't expect it to be able to work under no memory, but I do expect it to at least crash gracefully. The basic REPL spits this out before exiting: ``` object address : 0x7f02f532d180 object refcount : 3 object type : 0x7f02f5ec7780 object type name: MemoryError object repr : lost sys.stderr ``` Ideally, the new REPL should do something similar. This isn't at all a priority, but something fun for anyone bored and willing to take a stab at it. ### CPython versions tested on: 3.13 ### Operating systems tested on: Linux <!-- gh-linked-prs --> ### Linked PRs * gh-138491 <!-- /gh-linked-prs -->
Activity
sergey-miryanov commentedon May 18, 2025
On windows 11 it works as expected (virtual terminal support on)
donbarbos commentedon May 18, 2025
I also didn't get any hangs either using
./configure --with-pydebug && makeon Linux (I tested on gcc and clang):ZeroIntensity commentedon May 18, 2025
Ah, I screwed up when testing. 3.14 and 3.15 do exhibit the correct behavior, but not 3.13. My bad!
[-]The REPL hangs under no memory[/-][+]The REPL hangs under no memory on 3.13[/+][3.13] gh-134163: Fix an infinite loop when the process runs out of m…
ZeroIntensity commentedon Sep 10, 2025
Thanks @yihong0618 for the fix!