diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-03-01 23:34:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 23:34:44 (GMT) |
commit | 1f24a719e7be5e49b876a5dc7daf21d01ee69faa (patch) | |
tree | 8f8f56cab78ef671a8cb7f54b8ec2495d9a435e6 /Misc | |
parent | 7eebbbd5b3907447eddadf5cb7cb1cc9230d15b2 (diff) | |
download | cpython-1f24a719e7be5e49b876a5dc7daf21d01ee69faa.zip cpython-1f24a719e7be5e49b876a5dc7daf21d01ee69faa.tar.gz cpython-1f24a719e7be5e49b876a5dc7daf21d01ee69faa.tar.bz2 |
bpo-35808: Retire pgen and use pgen2 to generate the parser (GH-11814)
Pgen is the oldest piece of technology in the CPython repository, building it requires various #if[n]def PGEN hacks in other parts of the code and it also depends more and more on CPython internals. This commit removes the old pgen C code and replaces it for a new version implemented in pure Python. This is a modified and adapted version of lib2to3/pgen2 that can generate grammar files compatibles with the current parser.
This commit also eliminates all the #ifdef and code branches related to pgen, simplifying the code and making it more maintainable. The regen-grammar step now uses $(PYTHON_FOR_REGEN) that can be any version of the interpreter, so the new pgen code maintains compatibility with older versions of the interpreter (this also allows regenerating the grammar with the current CI solution that uses Python3.5). The new pgen Python module also makes use of the Grammar/Tokens file that holds the token specification, so is always kept in sync and avoids having to maintain duplicate token definitions.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2019-02-11-00-50-03.bpo-11814.M12CMH.rst | 2 | ||||
-rw-r--r-- | Misc/coverity_model.c | 8 |
2 files changed, 2 insertions, 8 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-02-11-00-50-03.bpo-11814.M12CMH.rst b/Misc/NEWS.d/next/Core and Builtins/2019-02-11-00-50-03.bpo-11814.M12CMH.rst new file mode 100644 index 0000000..b3bec72 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-02-11-00-50-03.bpo-11814.M12CMH.rst @@ -0,0 +1,2 @@ +Retire pgen and use a modified version of pgen2 to generate the parser. +Patch by Pablo Galindo. diff --git a/Misc/coverity_model.c b/Misc/coverity_model.c index 1ae6179..8960362 100644 --- a/Misc/coverity_model.c +++ b/Misc/coverity_model.c @@ -92,14 +92,6 @@ wchar_t *Py_DecodeLocale(const char* arg, size_t *size) return w; } -/* Parser/pgenmain.c */ -grammar *getgrammar(const char *filename) -{ - grammar *g; - __coverity_tainted_data_sink__(filename); - return g; -} - /* Python/marshal.c */ static Py_ssize_t r_string(char *s, Py_ssize_t n, RFILE *p) |