[issue43121] Incorrect SyntaxError message for missing comma (3.10.a5)

Andre Roberge report at bugs.python.org
Wed Feb 3 19:15:43 EST 2021


Andre Roberge <andre.roberge at gmail.com> added the comment:

Pablo: to run the friendly-traceback test suite is simply a matter of typing "pytest" from the root directory of the repository (after installing the dependencies). However, it would not be helpful for the purpose of CPython development, as likely more failing tests would be due to Friendly-traceback itself.

As a first step, Friendly-traceback tries to make use of the information given by Python (for example, the new "expected ':'"); if it does not recognize the message, or if the message is "invalid syntax", it uses some heuristics to guess what might be the probable cause. 

Improvements to the messages given by CPython are likely going to initially result in failed tests for Friendly-traceback, whether the information provided by CPython is valid (most of the time) or not.

The test suite I use includes things that I imagine a beginner might write. For example, using "else if" instead of "elif".  With one of the newest additions of CPython ("expected ':'") which is accurate in most cases, this specific unit test would likely fail until I make the appropriate adjustement to Friendly-traceback.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43121>
_______________________________________


More information about the Python-bugs-list mailing list