Skip to content

The REPL hangs under no memory on 3.13 #134163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ZeroIntensity opened this issue May 17, 2025 · 3 comments
Open

The REPL hangs under no memory on 3.13 #134163

ZeroIntensity opened this issue May 17, 2025 · 3 comments
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@ZeroIntensity
Copy link
Member

ZeroIntensity commented May 17, 2025

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

@ZeroIntensity ZeroIntensity added type-bug An unexpected behavior, bug, or error 3.13 bugs and security fixes 3.14 bugs and security fixes topic-repl Related to the interactive shell 3.15 new features, bugs and security fixes labels May 17, 2025
@picnixz picnixz added the stdlib Python modules in the Lib dir label May 17, 2025
@sergey-miryanov
Copy link
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
Copy link
Contributor

donBarbos commented May 18, 2025

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
Copy link
Member Author

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

@ZeroIntensity ZeroIntensity removed 3.14 bugs and security fixes 3.15 new features, bugs and security fixes labels May 18, 2025
@ZeroIntensity ZeroIntensity changed the title The REPL hangs under no memory The REPL hangs under no memory on 3.13 May 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants