Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
Description
Bug report
Bug description:
It's possible to make the interpreter exit on Windows in 3.13.0b4 and main due to ValueError: stat: path too long for Windows being raised by os.stat() in updatecache in linecache.py when trying to print a traceback:
>>>exec(compile("print(2**100000)", "s"*99999, "exec")) Exceptionignoredintheinternaltracebackmachinery: Traceback (mostrecentcalllast): File"~\PycharmProjects\cpython\Lib\traceback.py", line139, in_print_exception_bltinreturnprint_exception(exc, limit=BUILTIN_EXCEPTION_LIMIT, file=file, colorize=colorize) File"~\PycharmProjects\cpython\Lib\traceback.py", line129, inprint_exceptionte=TracebackException(type(value), value, tb, limit=limit, compact=True) File"~\PycharmProjects\cpython\Lib\traceback.py", line1133, in__init__context=TracebackException( File"~\PycharmProjects\cpython\Lib\traceback.py", line1043, in__init__self.stack=StackSummary._extract_from_extended_frame_gen( File"~\PycharmProjects\cpython\Lib\traceback.py", line492, in_extract_from_extended_frame_genf.lineFile"~\PycharmProjects\cpython\Lib\traceback.py", line369, inlineself._set_lines() File"~\PycharmProjects\cpython\Lib\traceback.py", line350, in_set_lineslines.append(linecache.getline(self.filename, lineno).rstrip()) File"~\PycharmProjects\cpython\Lib\linecache.py", line25, ingetlinelines=getlines(filename, module_globals) File"~\PycharmProjects\cpython\Lib\linecache.py", line41, ingetlinesreturnupdatecache(filename, module_globals) File"~\PycharmProjects\cpython\Lib\linecache.py", line100, inupdatecachestat=os.stat(fullname) ValueError: stat: pathtoolongforWindowsTraceback (mostrecentcalllast): File"~\PycharmProjects\cpython\Lib\code.py", line91, inruncodeexec(code, self.locals) File"<python-input-2>", line1, in<module>File"sss[...]sssssss", line1, in<module>ValueError: Exceedsthelimit (4300digits) forintegerstringconversion; usesys.set_int_max_str_digits() toincreasethelimitDuringhandlingoftheaboveexception, anotherexceptionoccurred: Traceback (mostrecentcalllast): File"~\PycharmProjects\cpython\Lib\runpy.py", line198, in_run_module_as_mainreturn_run_code(code, main_globals, None, File"~\PycharmProjects\cpython\Lib\runpy.py", line88, in_run_codeexec(code, run_globals) File"~\PycharmProjects\cpython\Lib\_pyrepl\__main__.py", line6, in<module>__pyrepl_interactive_console() File"~\PycharmProjects\cpython\Lib\_pyrepl\main.py", line59, ininteractive_consolerun_multiline_interactive_console(console) File"~\PycharmProjects\cpython\Lib\_pyrepl\simple_interact.py", line156, inrun_multiline_interactive_consolemore=console.push(_strip_final_indent(statement), filename=input_name, _symbol="single") # type: ignore[call-arg]File"~\PycharmProjects\cpython\Lib\code.py", line303, inpushmore=self.runsource(source, filename, symbol=_symbol) File"~\PycharmProjects\cpython\Lib\_pyrepl\console.py", line200, inrunsourceself.runcode(code) File"~\PycharmProjects\cpython\Lib\code.py", line95, inruncodeself.showtraceback() File"~\PycharmProjects\cpython\Lib\_pyrepl\console.py", line168, inshowtracebacksuper().showtraceback(colorize=self.can_colorize) File"~\PycharmProjects\cpython\Lib\code.py", line147, inshowtracebacklines=traceback.format_exception(ei[0], ei[1], last_tb.tb_next, colorize=colorize) File"~\PycharmProjects\cpython\Lib\traceback.py", line154, informat_exceptionte=TracebackException(type(value), value, tb, limit=limit, compact=True) File"~\PycharmProjects\cpython\Lib\traceback.py", line1043, in__init__self.stack=StackSummary._extract_from_extended_frame_gen( File"~\PycharmProjects\cpython\Lib\traceback.py", line492, in_extract_from_extended_frame_genf.lineFile"~\PycharmProjects\cpython\Lib\traceback.py", line369, inlineself._set_lines() File"~\PycharmProjects\cpython\Lib\traceback.py", line350, in_set_lineslines.append(linecache.getline(self.filename, lineno).rstrip()) File"~\PycharmProjects\cpython\Lib\linecache.py", line25, ingetlinelines=getlines(filename, module_globals) File"~\PycharmProjects\cpython\Lib\linecache.py", line41, ingetlinesreturnupdatecache(filename, module_globals) File"~\PycharmProjects\cpython\Lib\linecache.py", line100, inupdatecachestat=os.stat(fullname) ValueError: stat: pathtoolongforWindows [Thread30100.0x6108exitedwithcode1] [Thread30100.0x5da4exitedwithcode1] [Thread30100.0x90a0exitedwithcode1] [Inferior1 (process30100) exitedwithcode01]CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Windows
Linked PRs
- gh-122170: Fix interpreter exiting due to ValueError from
os.statfor too long filename on Windows #122175 - gh-122170: Handle
ValueErrorraised byos.statinlinecache#122176 - [3.13] gh-122170: Handle ValueError raised by os.stat() in linecache (GH-122176) #122348
- [3.12] gh-122170: Handle ValueError raised by os.stat() in linecache (GH-122176) #122349