RustPython icon indicating copy to clipboard operation
RustPython copied to clipboard

Syntax error messages are different from CPython's

Open coolreader18 opened this issue 3 years ago • 5 comments

See e.g. #2570. Some of the unit tests there with "wrong error message" should be somewhat easy to fix - just correct the error message we have to match CPython's. Others might be trickier, since you'll need to add diagnostics to recognize bad syntax and give a more detailed error than "unexpected token". Also, I think around half of them could be fixed just by adding "invalid syntax" in the message for an unexpected token, since they're just checking for "invalid syntax" anywhere in the message (it's just what CPython uses to mean an unexpected token, I think).

coolreader18 avatar Apr 21 '21 21:04 coolreader18

This will also change when we decide to start emulating CPython 3.10, as that version will feature more helpful error messages.

fanninpm avatar May 12 '21 16:05 fanninpm

Hi, is someone picking up this issue? I can pick it up in such a case. Is there a list of what messages are different?

hk1997 avatar Sep 09 '21 12:09 hk1997

Yes, a list of what's left to be changed would be priceless.

mardab avatar Sep 23 '21 17:09 mardab

@hk1997 @mardab it's in Lib/test/test_named_expressions.py

fanninpm avatar Sep 23 '21 18:09 fanninpm

PR #3206 fixed the "invalid syntax" ones. I tried working on the others, but don't know rust so these might be beyond my abilities.

chrismoradi avatar Oct 05 '21 14:10 chrismoradi