Repository navigation
New REPL exits when there are non-string candidates for suggestions #130999
Description
Activity
- addedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Mar 9, 2025 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestopic-replRelated to the interactive shellRelated to the interactive shelltype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump3.12only security fixesonly security fixesand removedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dumptype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error3.12only security fixesonly security fixes
on Mar 9, 2025 Ok, I'll say it's a bug for 3.13/3.14 and a crash for 3.12 but the crash issue is tracked elsewhere
Reacted by devdanzinIn dup #133748, the code was
globals().update({123: 'test'}); not_defined. However,globals()[123] = 'a'; xxxalso works. Both of these (on Windows) have just one "During handling ..." section. If REPL is started from an icon, it 'crashes' in that the window closes when the REPL quits due to its internal error (instead of printing the traceback and then a new '>>>' prompt).On the other issue, @StanFromIreland proposed, as I understand it, that globals be made a string-only dict. Since, AFAIK, it is not documented as such, I suspect that this would break something. As I remember, @gvanrossum once rejected the idea of making class
.__dict__string only, so that setting non-string attributes (with setattr, for instance), would raise. I think the same may be true for globals dict.With a non-string in globals,
dir()exits with "TypeError: '<' not supported between instances of 'int' and 'str'". This says a) non-strings in globals are not ordinarily a good idea, but b) the possibility has be anticipated and gracefully handled. The simplest solution here is for the hinter to ignore non-strings as possible name corrections, as they definitely are not, instead of crashing the REPL.6 remaining items
I think the fix here is what's causing the buildbot failure seen at: https://buildbot.python.org/#/builders/1368/builds/3297:
test test_traceback crashed -- Traceback (most recent call last): File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/libregrtest/single.py", line 210, in _runtest_env_changed_exc _load_run_test(result, runtests) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/libregrtest/single.py", line 165, in _load_run_test regrtest_runner(result, test_func, runtests) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/libregrtest/single.py", line 114, in regrtest_runner refleak, test_result = runtest_refleak(result.test_name, test_func, ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ runtests.hunt_refleak, ^^^^^^^^^^^^^^^^^^^^^^ runtests.quiet) ^^^^^^^^^^^^^^^ File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/libregrtest/refleak.py", line 138, in runtest_refleak result = test_func() File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/libregrtest/single.py", line 162, in test_func return run_unittest(test_mod, runtests) File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/test/libregrtest/single.py", line 33, in run_unittest tests = loader.loadTestsFromModule(test_mod) File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.refleak.nogil/build/Lib/unittest/loader.py", line 100, in loadTestsFromModule for name in dir(module): ~~~^^^^^^^^ TypeError: '<' not supported between instances of 'int' and 'str' 1 test failed again: test_tracebackReacted by Łukasz LangaI'm on it.
- added 6 commits that reference this issue
on Jun 2, 2025
Crash report
What happened?
The new REPL in main will exit if a suggestion would be offered, but there are non-string candidates like below:
This is an offshoot of #129573, where code like above would abort in 3.12.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a5+ (heads/main:a3990df6121, Mar 9 2025, 00:02:58) [GCC 13.3.0]
Linked PRs