classification
Title: Remove the old parser
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pablogsal Nosy List: brandtbucher, gvanrossum, lys.nikolaou, miss-islington, ned.deily, nnemkin, pablogsal, terry.reedy, vstinner
Priority: normal Keywords: patch

Created on 2020-06-10 11:25 by pablogsal, last changed 2020-09-18 01:57 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20768 merged pablogsal, 2020-06-10 11:25
PR 20800 merged lys.nikolaou, 2020-06-11 11:02
PR 20801 merged miss-islington, 2020-06-11 12:45
PR 20802 merged lys.nikolaou, 2020-06-11 13:13
PR 20814 merged pablogsal, 2020-06-11 16:43
PR 20815 merged pablogsal, 2020-06-11 16:46
PR 20822 merged pablogsal, 2020-06-12 00:25
PR 21005 merged lys.nikolaou, 2020-06-20 16:53
PR 21012 merged lys.nikolaou, 2020-06-20 18:34
PR 21016 merged lys.nikolaou, 2020-06-20 19:26
PR 21025 merged pablogsal, 2020-06-21 03:06
PR 21036 merged lys.nikolaou, 2020-06-21 23:46
PR 21152 merged ned.deily, 2020-06-25 14:23
PR 21624 merged gvanrossum, 2020-07-26 03:22
PR 19969 merged pablogsal, 2020-07-26 21:47
PR 21641 merged gvanrossum, 2020-07-27 18:31
PR 21642 merged lys.nikolaou, 2020-07-27 18:57
PR 22294 merged terry.reedy, 2020-09-18 01:07
Messages (37)
msg371182 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-10 11:25
As stated in PEP 617, the old parser will be removed in Python 3.10
msg371264 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-11 12:45
New changeset 9727694f08cad4b019d2939224e3416312b1c0e1 by Lysandros Nikolaou in branch 'master':
bpo-40939: Generate keyword.py using the new parser (GH-20800)
https://github.com/python/cpython/commit/9727694f08cad4b019d2939224e3416312b1c0e1
msg371265 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 12:50
>>> __new_parser__
  File "<stdin>", line 1
    __new_parser__
    ^
SyntaxError: You found it!

"new", "ex" or "ng" are not really future proof names. Can we rename the keyword to "__peg_parser__"?
msg371266 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-11 12:59
> Can we rename the keyword to "__peg_parser__"?

I guess we could just remove this, as soon as the old parser is out. We were only using this to differentiate between the two parsers, when we were testing enabling/disabling the old one. I could get a PR ready to be merged after GH-20768 is there.
msg371267 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-11 13:01
> I guess we could just remove this, as soon as the old parser is out. We were only using this to differentiate between the two parsers, when we were testing enabling/disabling the old one. I could get a PR ready to be merged after GH-20768 is there.

I would personally would like to keep the easter egg, but I assume is better to rename it to "__peg_parser__".
msg371268 - (view) Author: miss-islington (miss-islington) Date: 2020-06-11 13:02
New changeset 961edf7979ca34d6fe104a1cce005aa8cac35821 by Miss Islington (bot) in branch '3.9':
bpo-40939: Generate keyword.py using the new parser (GH-20800)
https://github.com/python/cpython/commit/961edf7979ca34d6fe104a1cce005aa8cac35821
msg371270 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-11 13:08
> I would personally would like to keep the easter egg, but I assume is better to rename it to "__peg_parser__".

Ok then! On it.
msg371271 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 13:17
I did'nt ask to remove the easter egg. I'm just asking to avoid the "new" name. In my experience, each time that a "new" thing happens, later we have to use "new extended", "new_v2" or worse name :-)

Oh, if the name changes, please change it in 3.9 as well.


Look at this amazing names of the 5 flavors of functions parsing a string:

PyParser_ParseString()
PyParser_ParseStringFlags()
PyParser_ParseStringFlagsFilename()
PyParser_ParseStringFlagsFilenameEx() <= public!
PyParser_ParseStringObject()

Same for parsing a file:

PyParser_ParseFile()
PyParser_ParseFileFlags()
PyParser_ParseFileFlagsEx() <= public!
PyParser_ParseFileObject()

Or PyRun functions:

PyRun_String()
PyRun_AnyFile()
PyRun_AnyFileEx() <= public!
PyRun_AnyFileFlags()
PyRun_SimpleString()
PyRun_SimpleFile()
PyRun_SimpleFileEx() <= public!
PyRun_InteractiveOne()
PyRun_InteractiveLoop()
PyRun_File()
PyRun_FileEx() <= public!
PyRun_FileFlags()

ceval.c:

PyEval_EvalCode()
PyEval_EvalCodeEx() <= public!
_PyEval_EvalCodeWithName()
_PyEval_EvalCode()

I cannot count the number of "Ex" functions that we have :-)

Py_Finalize() -> :Py_FinalizeEx() <= public!
PyErr_Print() -> PyErr_PrintEx() <= public!
PySys_SetArgv() -> PySys_SetArgvEx() <= public!
PyErr_WarnEx() <= public!

_PyBytes_FormatEx()
_PyDict_MergeEx()
_Py_DecodeLocaleEx(), _Py_EncodeLocaleEx()
struct PyMemAllocatorEx
_Py_DecodeUTF8Ex(), _Py_EncodeUTF8Ex()
etc.
msg371288 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-06-11 14:27
Honestly I see no reason to keep that easter egg. Can we remove it please?
msg371289 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 14:29
> New changeset 961edf7979ca34d6fe104a1cce005aa8cac35821 by Miss Islington (bot) in branch '3.9':
> bpo-40939: Generate keyword.py using the new parser (GH-20800)

This change broke this buildbot:

AMD64 Arch Linux VintageParser 3.9:
https://buildbot.python.org/all/#/builders/765/builds/67
1 test failed: test_keyword
msg371290 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-11 14:32
Ok, let's remove it. Lysandros can you modify PR 20802 to remove it?
msg371291 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-11 14:48
> Lysandros can you modify PR 20802 to remove it?

Yup!
msg371292 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-11 14:55
> This change broke this buildbot:

GH-20802 fixes this breakage.
msg371301 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-06-11 16:09
New changeset bcd7deed9118e365c1225de2a2e1a81bf988c6ab by Lysandros Nikolaou in branch 'master':
bpo-40939: Remove PEG parser easter egg (__new_parser__) (#20802)
https://github.com/python/cpython/commit/bcd7deed9118e365c1225de2a2e1a81bf988c6ab
msg371307 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-11 16:30
New changeset 1ed83adb0e95305af858bd41af531e487f54fee7 by Pablo Galindo in branch 'master':
bpo-40939: Remove the old parser (GH-20768)
https://github.com/python/cpython/commit/1ed83adb0e95305af858bd41af531e487f54fee7
msg371308 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-11 16:36
A few remaining references to the good old times of the old parser:

Programs/_testembed.c:488:    putenv("PYTHONOLDPARSER=1");
Programs/_testembed.c:676:    putenv("PYTHONOLDPARSER=1");
Tools/scripts/run_tests.py:29:    if 'PYTHONOLDPARSER' not in os.environ:
msg371310 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-11 16:46
> A few remaining references to the good old times of the old parser:

Thanks Victor, opened https://github.com/python/cpython/pull/20815 to address those.
msg371311 - (view) Author: miss-islington (miss-islington) Date: 2020-06-11 17:08
New changeset 436b648910c27baf8164a6d46d746d36d8a93478 by Pablo Galindo in branch 'master':
bpo-40939: Remove some extra references to PYTHONOLDPARSER (GH-20815)
https://github.com/python/cpython/commit/436b648910c27baf8164a6d46d746d36d8a93478
msg371316 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-11 18:29
New changeset 3782497cc22e70b41e32ac09cb06d3948074d8a7 by Pablo Galindo in branch '3.9':
[3.9] bpo-40939: Fix test_keyword for the old parser (GH-20814)
https://github.com/python/cpython/commit/3782497cc22e70b41e32ac09cb06d3948074d8a7
msg371327 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-12 00:55
New changeset 756180b4bfa09bb77394a2b3754d331181d4f28c by Pablo Galindo in branch 'master':
bpo-40939: Clean and adapt the peg_generator directory after deleting the old parser (GH-20822)
https://github.com/python/cpython/commit/756180b4bfa09bb77394a2b3754d331181d4f28c
msg371929 - (view) Author: Nikita Nemkin (nnemkin) * Date: 2020-06-20 10:01
Shouldn't the following files be deleted too?

Include/bitset.h
Include/grammar.h
Include/graminit.h
Include/parsetok.h
Include/node.h
Python/graminit.c
Parser/node.c

Also declarations:
PyNode_Compile in Include/compile.h
PyParser_SimpleParse* in Include/pythonrun.h

And PyParser_ASTFrom* API need new implementations.
msg371940 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-20 15:45
I'm currently testing a commit that removes all these files on my fork, before I push it upstream. A question that I'm not 100% sure about is if we can already remove the symbol module. I guess it's okay since it got deprecated in 3.9 (bpo-40759) and the old parser is also out, but just to make sure.
msg371942 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-06-20 16:31
You can delete symbol.py -- it has no use now that the old parser is gone.

We should probably also update the regeneration targets in the Makefile. (At least review them.)
msg371953 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-20 18:07
New changeset 314858e2763e76e77029ea0b691d749c32939087 by Lysandros Nikolaou in branch 'master':
bpo-40939: Remove the old parser (Part 2) (GH-21005)
https://github.com/python/cpython/commit/314858e2763e76e77029ea0b691d749c32939087
msg371977 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-21 01:16
New changeset d301d9473e9a9b78d6e6678e9fe5ef66d46084e1 by Lysandros Nikolaou in branch '3.9':
[3.9] bpo-40939: Deprecate the PyParser_SimpleParse* functions (GH-21012)
https://github.com/python/cpython/commit/d301d9473e9a9b78d6e6678e9fe5ef66d46084e1
msg372023 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-21 21:34
> bpo-40939: Remove the old parser (Part 2) (GH-21005)

This change removes PyNode_Compile() which is part of the public C API. Would you mind to also deprecate it, as you did for PyParser_xxx() functions?
msg372025 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-21 23:47
New changeset 564cd187677ae8d1488c4d8ae649aea34ebbde07 by Lysandros Nikolaou in branch 'master':
bpo-40939: Rename PyPegen* functions to PyParser* (GH-21016)
https://github.com/python/cpython/commit/564cd187677ae8d1488c4d8ae649aea34ebbde07
msg372026 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-21 23:49
Thanks Victor for the catch! I've opened a PR that deprecates PyNode_Compile in 3.9.
msg372027 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 00:07
New changeset 8ae5e8ec8147e6434454e66953c25848b848711a by Lysandros Nikolaou in branch '3.9':
[3.9] bpo-40939: Deprecate PyNode_Compile (GH-21036)
https://github.com/python/cpython/commit/8ae5e8ec8147e6434454e66953c25848b848711a
msg372370 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-06-25 14:46
New changeset 8d02f91dc6139a13b6efa9bd5a5b4bdd7ddcc29d by Ned Deily in branch 'master':
bpo-40939: run autoreconf to fix configure{,.ac} disparity (GH-21152)
https://github.com/python/cpython/commit/8d02f91dc6139a13b6efa9bd5a5b4bdd7ddcc29d
msg374282 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-07-25 21:25
There are some difficulties with removing Grammar/Grammar, since it is used to generate the full grammar in the reference docs (Doc/reference/grammar.rst). Producing a similar grammar from the PEG grammar is currently painful because our PEG grammar contains a number of "invalid_*" rules that just exist to be able to produce more useful error messages.

See https://github.com/we-like-parsers/cpython/issues/135.

The continued existence of Grammar/Grammar has confused at least one person, see issue41362.

Grepping for Grammar/Grammar in the docs, there are a few other occurrences:

library/token.rst:14:of the parse tree (terminal tokens).  Refer to the file :file:`Grammar/Grammar`
library/parser.rst:43::file:`Grammar/Grammar` in the standard Python distribution.  The parse trees
library/symbol.rst:15:names.  Refer to the file :file:`Grammar/Grammar` in the Python distribution for
reference/grammar.rst:7:.. literalinclude:: ../../Grammar/Grammar
msg374346 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-07-26 21:46
See also https://github.com/python/cpython/pull/19969 (Pablo's attempt at replacing the grammar in the reference docs with something derived from Grammar/python.gram).
msg374410 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-07-27 18:20
New changeset 72cabb2aa636272e608285f5a6ba83b62be9be4e by Pablo Galindo in branch 'master':
bpo-40939: Use the new grammar for the grammar specification documentation (GH-19969)
https://github.com/python/cpython/commit/72cabb2aa636272e608285f5a6ba83b62be9be4e
msg374413 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-07-27 18:38
The old parser is completely gone from the 3.10 branch. Closing.
msg374416 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-07-27 19:00
New changeset e6b2d93f0c3891827f609ecac1ced21e1626ed0a by Guido van Rossum in branch '3.9':
[3.9] bpo-40939: Use the new grammar for the grammar specification documentation (GH-19969) (#21641)
https://github.com/python/cpython/commit/e6b2d93f0c3891827f609ecac1ced21e1626ed0a
msg374417 - (view) Author: miss-islington (miss-islington) Date: 2020-07-27 19:53
New changeset b3fbff7289176ba1a322e6899c3d4a04880ed5a7 by Lysandros Nikolaou in branch 'master':
bpo-40939: Remove even more references to the old parser (GH-21642)
https://github.com/python/cpython/commit/b3fbff7289176ba1a322e6899c3d4a04880ed5a7
msg377083 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-09-18 01:57
New changeset 5a8364780b7e881385f6fabcf072d599e80f51b8 by Terry Jan Reedy in branch 'master':
bpo-41808: Add What's New 3.9 entry missing from master (#22294)
https://github.com/python/cpython/commit/5a8364780b7e881385f6fabcf072d599e80f51b8
History
Date User Action Args
2020-09-18 01:57:12terry.reedysetmessages: + msg377083
2020-09-18 01:07:28terry.reedysetnosy: + terry.reedy

pull_requests: + pull_request21347
2020-07-27 19:53:06miss-islingtonsetmessages: + msg374417
2020-07-27 19:00:50gvanrossumsetmessages: + msg374416
2020-07-27 18:57:57lys.nikolaousetpull_requests: + pull_request20783
2020-07-27 18:38:59gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg374413

stage: patch review -> resolved
2020-07-27 18:31:35gvanrossumsetpull_requests: + pull_request20782
2020-07-27 18:20:44gvanrossumsetmessages: + msg374410
2020-07-26 21:47:49pablogsalsetpull_requests: + pull_request20774
2020-07-26 21:46:40gvanrossumsetmessages: + msg374346
2020-07-26 03:22:31gvanrossumsetpull_requests: + pull_request20765
2020-07-25 21:25:46gvanrossumsetmessages: + msg374282
2020-06-25 14:46:53ned.deilysetmessages: + msg372370
2020-06-25 14:23:10ned.deilysetnosy: + ned.deily
pull_requests: + pull_request20311
2020-06-22 00:07:49miss-islingtonsetmessages: + msg372027
2020-06-21 23:49:04lys.nikolaousetmessages: + msg372026
2020-06-21 23:47:50pablogsalsetmessages: + msg372025
2020-06-21 23:46:43lys.nikolaousetpull_requests: + pull_request20207
2020-06-21 21:34:14vstinnersetmessages: + msg372023
2020-06-21 03:06:33pablogsalsetpull_requests: + pull_request20197
2020-06-21 01:16:01pablogsalsetmessages: + msg371977
2020-06-20 19:26:43lys.nikolaousetpull_requests: + pull_request20190
2020-06-20 18:34:56lys.nikolaousetpull_requests: + pull_request20186
2020-06-20 18:07:29pablogsalsetmessages: + msg371953
2020-06-20 16:53:14lys.nikolaousetpull_requests: + pull_request20179
2020-06-20 16:31:55gvanrossumsetmessages: + msg371942
2020-06-20 15:45:54lys.nikolaousetmessages: + msg371940
2020-06-20 10:01:44nnemkinsetnosy: + nnemkin
messages: + msg371929
2020-06-12 00:55:41pablogsalsetmessages: + msg371327
2020-06-12 00:25:28pablogsalsetpull_requests: + pull_request20018
2020-06-11 18:29:20pablogsalsetmessages: + msg371316
2020-06-11 17:18:01brandtbuchersetnosy: + brandtbucher
2020-06-11 17:08:13miss-islingtonsetmessages: + msg371311
2020-06-11 16:46:54pablogsalsetmessages: + msg371310
2020-06-11 16:46:24pablogsalsetpull_requests: + pull_request20013
2020-06-11 16:43:27pablogsalsetpull_requests: + pull_request20012
2020-06-11 16:36:39vstinnersetmessages: + msg371308
2020-06-11 16:30:50pablogsalsetmessages: + msg371307
2020-06-11 16:09:24gvanrossumsetmessages: + msg371301
2020-06-11 14:55:52lys.nikolaousetmessages: + msg371292
2020-06-11 14:48:46lys.nikolaousetmessages: + msg371291
2020-06-11 14:32:28pablogsalsetmessages: + msg371290
2020-06-11 14:29:04vstinnersetmessages: + msg371289
2020-06-11 14:27:44gvanrossumsetmessages: + msg371288
2020-06-11 13:17:38vstinnersetmessages: + msg371271
2020-06-11 13:13:24lys.nikolaousetpull_requests: + pull_request19998
2020-06-11 13:08:00lys.nikolaousetmessages: + msg371270
2020-06-11 13:02:40miss-islingtonsetmessages: + msg371268
2020-06-11 13:01:07pablogsalsetmessages: + msg371267
2020-06-11 12:59:54lys.nikolaousetmessages: + msg371266
2020-06-11 12:50:41vstinnersetnosy: + vstinner
messages: + msg371265
2020-06-11 12:45:33miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request19997
2020-06-11 12:45:22pablogsalsetmessages: + msg371264
2020-06-11 11:02:44lys.nikolaousetpull_requests: + pull_request19996
2020-06-10 11:25:59pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request19972
2020-06-10 11:25:28pablogsalsetnosy: + gvanrossum, lys.nikolaou
2020-06-10 11:25:17pablogsalcreate