Allow SyntaxError.msg to be writable and reflected in string formatting by Copilot · Pull Request #6493 · RustPython/RustPython
<issue_title>AttributeError: attribute 'msg' of 'SyntaxError' objects is not writable</issue_title>
<issue_description>Hi! I'm trying to run xonsh and sometimes I have this stack trace e.g. in #6489 (comment) where the command ls /:
ls / Traceback (most recent call last): File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/shells/base_shell.py", line 524, in compile compile_empty_tree=False, File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/execer.py", line 131, in compile tree = self.parse(input, ctx, mode=mode, filename=filename, transform=transform) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/execer.py", line 87, in parse tree, input = self._parse_ctx_free(input, mode=mode, filename=filename) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/execer.py", line 346, in _parse_ctx_free return _try_parse(input, greedy=True) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/execer.py", line 344, in _parse_ctx_free return _try_parse(input, greedy=False) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/execer.py", line 338, in _try_parse input = "\n".join(lines) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/execer.py", line 239, in _try_parse debug_level=(self.debug_level >= 2), File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/base.py", line 505, in parse tree = self.parser.parse(input=s, lexer=self.lexer, debug=debug_level) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/ply/yacc.py", line 335, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/ply/yacc.py", line 1203, in parseopt_notrack tok = call_errorfunc(self.errorfunc, errtoken, self) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/ply/yacc.py", line 194, in call_errorfunc r = errorfunc(token) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/base.py", line 3685, in p_error self._parse_error(msg, self.currloc(lineno=p.lineno, column=p.lexpos)) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/base.py", line 632, in _parse_error raise_parse_error(msg, loc, self._source, self.lines) File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/parsers/base.py", line 212, in raise_parse_error err.msg = str(msg) if msg else "" AttributeError: attribute 'msg' of 'SyntaxError' objects is not writable ```</issue_description> <agent_instructions>Fix PySyntaxError to allow `msg` setter. Ensure `cargo run -- -m test test_exceptions -vv` success</agent_instructions> ## Comments on the Issue (you are @copilot in this section) <comments> </comments>