]> granicus.if.org Git - python/commit
bpo-24960: use pkgutil.get_data in lib2to3 to read pickled grammar files (#4977)
authorBenjamin Peterson <benjamin@python.org>
Fri, 22 Dec 2017 20:18:33 +0000 (12:18 -0800)
committerGitHub <noreply@github.com>
Fri, 22 Dec 2017 20:18:33 +0000 (12:18 -0800)
commit8a5877165e993afb2633cd48da5222326d3f6e0e
tree7b526a3ae7ea485ec2f023c03a07a93cc6253363
parent62ed6be8da5fd1142f838582ecdb338af539e85b
bpo-24960: use pkgutil.get_data in lib2to3 to read pickled grammar files (#4977)

This is more complicated than it should be because we need to preserve the
useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar
has. We only look for the pickled grammar file with pkgutil.get_data and only if
the source file does not exist.
Lib/lib2to3/pgen2/driver.py
Lib/lib2to3/pgen2/grammar.py
Lib/lib2to3/pygram.py
Lib/lib2to3/tests/test_parser.py
Misc/NEWS.d/next/Tools-Demos/2017-12-22-09-25-51.bpo-24960.TGdAgO.rst [new file with mode: 0644]