New submission from A. Skrobov <tyomi...@gmail.com>:
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? ---------- components: Extension Modules messages: 337619 nosy: A. Skrobov, benjamin.peterson, berker.peksag, brett.cannon, fdrake, giampaolo.rodola, gregory.p.smith, pablogsal, python-dev, serhiy.storchaka, xcombelle priority: normal severity: normal status: open title: parser module fails on legal input type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36256> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com