This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author A. Skrobov
Recipients A. Skrobov, benjamin.peterson, berker.peksag, brett.cannon, fdrake, giampaolo.rodola, gregory.p.smith, pablogsal, python-dev, serhiy.storchaka, xcombelle
Date 2019-03-10.16:36:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Under #26526, I had optimised the validation code in parser module to use the actual parser DFAs, but my code considers only the token types in the input, and doesn't distinguish between different NAMEs (e.g. different keywords).

The result is this:

Python 3.7.0 (default, Aug 22 2018, 20:50:05) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import parser
>>> parser.sequence2st(parser.suite("if True:\n pass\nelse:\n pass").totuple())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
parser.ParserError: Expected node type 305, got 11.

The fix for this bug is quite simple, and in fact, it had been languishing for 2.5 years under #26415

I can easily enough extract the fix into a PR of its own, but the bigger question is: parser module had been advised against using since Python 2.5; now that it has been broken for 2.5 years, nobody even noticed. (if-else must be quite a common code construct, so anybody trying to use the module would have noticed!) So, should perhaps the module be discontinued rather than fixed?
Date User Action Args
2019-03-10 16:36:59A. Skrobovsetrecipients: + A. Skrobov, fdrake, brett.cannon, gregory.p.smith, giampaolo.rodola, benjamin.peterson, python-dev, berker.peksag, serhiy.storchaka, xcombelle, pablogsal
2019-03-10 16:36:59A. Skrobovsetmessageid: <>
2019-03-10 16:36:58A. Skrobovlinkissue36256 messages
2019-03-10 16:36:58A. Skrobovcreate