Skip to content

The REPL hangs under no memory on 3.13 #134163

Open
@ZeroIntensity

Description

@ZeroIntensity

Bug report

Bug description:

In the new REPL, failing allocations seem to cause the prompt to get stuck:

>>> 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

Activity

added
type-bugAn unexpected behavior, bug, or error
3.13bugs and security fixes
3.14bugs and security fixes
topic-replRelated to the interactive shell
3.15new features, bugs and security fixes
on May 17, 2025
sergey-miryanov

sergey-miryanov commented on May 18, 2025

@sergey-miryanov
Contributor

On windows 11 it works as expected (virtual terminal support on)

 [2025-05-18 15:21:11] [D:\Sources\_pythonish\cpython\main]  [main ≡ +17 ~10 -0 !] [󰅒 1:56.656]
➜ .\python.bat
Running Release|x64 interpreter...
Python 3.15.0a0 (heads/main-dirty:0a160bf14c4, May 18 2025, 15:19:49) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _testcapi
>>> _testcapi.set_nomemory(0)
object address  : 00000269B229DF00
object refcount : 3
object type     : 00007FF8887AFDF0
object type name: MemoryError
object repr     :
lost sys.stderr
donBarbos

donBarbos commented on May 18, 2025

@donBarbos
Contributor

On windows 11 it works as expected (virtual terminal support on)

I also didn't get any hangs either using ./configure --with-pydebug && make on Linux (I tested on gcc and clang):

>>> _testcapi.set_nomemory(0)
object address  : 0x79d5e61a42f0
object refcount : 3
object type     : 0x591fb1b34f40
object type name: MemoryError
object repr     :
lost sys.stderr
ZeroIntensity

ZeroIntensity commented on May 18, 2025

@ZeroIntensity
MemberAuthor

Ah, I screwed up when testing. 3.14 and 3.15 do exhibit the correct behavior, but not 3.13. My bad!

removed
3.14bugs and security fixes
3.15new features, bugs and security fixes
on May 18, 2025
changed the title [-]The REPL hangs under no memory[/-] [+]The REPL hangs under no memory on 3.13[/+] on May 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesstdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      The REPL hangs under no memory on 3.13 · Issue #134163 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant